1

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

2 Answers2

0

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

Thanks Microsoft!

0

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"
bjoster
  • 4,423
  • 5
  • 22
  • 32