Score:1

cmd pipe -> System cannot find specified path

cn flag

Using cmd on Windows 10 Pro 21H2, when I try

echo Hello | find "Bye"

I get The system cannot find the specified path. Same thing if trying

echo Hello | C:\Windows\System32\find.exe "Bye"

So PATH does not appear to be the problem.

I need this working because of how Visual Studio Code connects to ssh servers:

type "C:\Users\thomedes\AppData\Local\Temp\vscode-linux-multi-line-command-vpc-13769646.sh" | ssh -T -D 64480 server bash

which gives exactly the same issue.

EDIT:

Just tried on an old machine with Windows XP. Works flawlessly.

EDIT:

System info. It's in Spanish, but should be easy to understand. I'ts a normal Windows 10 installation. No magic tricks.

C:\Users\thomedes>dir echo*
El volumen de la unidad C es Windows
El número de serie del volumen es: XXXX-XXXX

Directorio de C:\Users\thomedes

No se encuentra el archivo

C:\Users\thomedes>dir find*
El volumen de la unidad C es Windows
El número de serie del volumen es: XXXX-XXXX

Directorio de C:\Users\thomedes

No se encuentra el archivo

C:\Users\thomedes>where find
C:\Windows\System32\find.exe

C:\Users\thomedes>where echo
INFORMACIÓN: no se pudo encontrar ningún archivo para los patrones dados.

Some more info, it runs fine when done like this:

C:\Users\thomedes>echo Hello > foo
C:\Users\thomedes>find "Bye" < foo
JosefZ avatar
th flag
Please [edit] your question to share `dir echo*`, `dir find*`, `where find` and `where echo`.
cn flag
@JosefZ Done. It'a a plain windows 10 installation. echo is CMD's internal echo command. find is Windows' "grep".
Duston avatar
sd flag
Could not recreate the problem -- P:\>echo hello | find "hello" hello
djdomi avatar
za flag
you should consider that find is by default cade sensitive, you may use `echo HeLlo | findstr /i "hello"
cn flag
@Duston Can you please share the -exact- version of Windows you are using? 20H2? 21H1? 21H2? Thanks
cn flag
Thanks @djsomi, the problem is not about the find command. It's about cmd failing when I use a pipe ( | ).
Duston avatar
sd flag
Microsoft Windows [Enterprise] 21H1 [Version 10.0.19043.1526]
cn flag
@Duston Thanks. As I thought, apparently, 21H2 has broken the pipe in CMD. Will try to confirm it.
Score:0
cn flag

Answering myself because the problem is gone after a Windows Update.

Thanks Microsoft!

Score:0
cn flag

Always use findstr (windows's grep alternative) when grepping in pipes. find does other stuff, too.

This will work on any Windows version:

echo Hello | findstr "Bye"
cn flag
Thanks @bjoster, but the problem was not about using find. The issue was about using pipes with a CMD internal command.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.