Groups > Microsoft > Windows PowerShell > Re: get-help not working on FIND command




get-help not working on FIND command

get-help not working on FIND command
Tue, 15 Apr 2008 21:26:01 -070
Hello PowerShell Users,

I'm trying the following:

get-alias find
get-help find

and getting an error message "Get-Alias: Cannot find alias because alias 
'find' does not exist"

But, when I just type FIND I get the following: "FIND: Parameter format not

correct"

How would I use FIND in PowerShell or is there another cmdlet which does the 
same thing?

Thanks,

Jeff Jensen

Post Reply
Re: get-help not working on FIND command
Tue, 15 Apr 2008 23:32:57 -060
Hi Jeff,
You can get FIND's help just as you would from CMD like this:

find /?

You can see which commands are available with Get-Command, or its alias gcm:
gcm find

...and get more info by piping Get-Command's output to Format-List, or its alias
fl:
gcm find | fl *

When searching for text with FIND from PowerShell the tricky part is passing the
"string" to search for, you can...

# assign the "string" to a variable
$str = 'Installed file'
find /i $str $env:windir\DirectX.log

# escape the double quotes:
find /i `"Installed file`" $env:windir\DirectX.log

# wrap the double-quoted "string" in single quotes:
find /i '"Installed file"' C:\Windows\DirectX.log

------
PowerShell's more powerful version of FIND is Select-String. For help on it:

help Select-String

-- 
Kiron
Post Reply
Re: get-help not working on FIND command
Tue, 15 Apr 2008 23:35:12 -070
On Apr 15, 9:26 pm, Jeffery Jensen
<JefferyJen...@discussions.microsoft.com> wrote:
> Hello PowerShell Users,
>
> I'm trying the following:
>
> get-alias find
> get-help find
>
> and getting an error message "Get-Alias: Cannot find alias because
alias
> 'find' does not exist"
>
> But, when I just type FIND I get the following: "FIND: Parameter
format not
> correct"
>
> How would I use FIND in PowerShell or is there another cmdlet which does
the
> same thing?
>
> Thanks,
>
> Jeff Jensen

This command will look for all of the .exe files off of c:\temp and
recurse into the subdirectories:
Get-ChildItem -Recurse c:\temp *.exe

You can get fancy and pipe it to sort-object like so to list the
largest files first:
Get-ChildItem -Recurse c:\temp *.exe | Sort-Object length -descending

The following are aliases to Get-ChildItem:
gci, ls, dir

Take care,
Post Reply
about | contact