i'm getting an error of "FIND: Parameter format not correct" in powershell
The following works from CMD
C:\Users\User>echo abc | find "a"
abc
C:\Users\User>echo abc>z.z
C:\Users\User>find "a" z.z
---------- Z.Z
abc
C:\Users\User>
But this fails from powershell!
PS C:\Users\User> echo abc | find "a"
FIND: Parameter format not correct
PS C:\Users\User> echo abc >z.z
PS C:\Users\User> find "a" z.z
FIND: Parameter format not correct
PS C:\Users\User>
There is a similar question here "FIND: Parameter format not correct" and "FINDSTR: Write error" with Pipes where the answer says to use quotation marks with the find command. Though I have And I wouldn't be using /C because i'm not trying to count occurrences. Though find /c isn't working either
PS C:\Users\User> find /C "a" z.z
FIND: Parameter format not correct
PS C:\Users\User>
And it's not a UK keyboard issue, where two pipe characters get swapped. 'cos it works in cmd and not powershell. And I tried copy/pasting the correct pipe character from charmap. And as yo see this occurs also with the format of find [pattern] file. So without any pipe. So, not a pipe issue.
There's something about powershell and find, that is going wrong here. Where cmd is fine.
Added
Upon further investigation
PS C:\Users\User> which find
/cygdrive/c/Windows/system32/find
PS C:\Users\User>
Makes me wonder, is that a PATH problem it's clashing with cygwin?
I don't think it's a PATH problem, because that's just cygwin's way of stating that the path is in c:\windows\system32 but does look like a weird clash with cygwin though in some way.. not sure if relevant to the problem.
It is running windows FIND
PS C:\Users\User> find /?
Searches for a text string in a file or files.
FIND [/V] [/C] [/N] [/I] [/OFF[LINE]] "string" [[drive:][path]filename[ ...]]
/V Displays all lines NOT containing the specified string.
/C Displays only the count of lines containing the string.
/N Displays line numbers with the displayed lines.
/I Ignores the case of characters when searching for the string.
/OFF[LINE] Do not skip files with offline attribute set.
"string" Specifies the text string to find.
[drive:][path]filename
Specifies a file or files to search.
If a path is not specified, FIND searches the text typed at the prompt
or piped from another command.
PS C:\Users\User>