6
1
I have started seeing some very strange issues with the pipe command not working on Windows 7 64-bit on my machine. Commands like this:
echo test | more
used to work without a problem, but now they fail with the following error message:
'.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC' is not recognized as an internal or external command, operable program or batch file.
It also doesn't seem to matter what is on the left and right sides of the pipe, any command line instruction with a pipe in it fails. It also doesn't seem to make a difference if the right hand side of the pipe is not a proper executable at all.
E.g. the following both exhibit the same failing behaviour:
type file1 | findstr blah
dir | thisdoesnotexist
All of these things worked fine a week ago, and I'm not sure what could have changed. There was possibly a Windows update that occurred at the time it stopped working, but I don't know for sure.
My %PATH%
and %PATHEXT%
environment variables both look OK too. Their contents look like the following:
Path=C:\Program Files\Common Files\Microsoft Shared\Microsoft Online Services;
C:\Program Files (x86)\Common Files\Microsoft Shared\Microsoft Online Services;
C:\Windows\system32;
C:\Windows;
C:\Windows\System32\Wbem;
C:\Windows\System32\WindowsPowerShell\v1.0\;
C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;
C:\Program Files (x86)\Common Files\Roxio Shared\10.0\DLLShared\;
C:\Programs\WinMerge;
C:\Programs\TortoiseHg\;
C:\Programs\MySQL\MySQL Server 5.1\bin;
C:\Programs\Aldec\Active-HDL 9.1\bin;
C:\Programs\Tcl\bin;
C:\Programs\modeltech_pe_10.0b\win32pe;
C:\Programs\Atlassian\atlassian-plugin-sdk-3.2.3\bin;
C:\Xilinx\12.4\ISE_DS\ISE\bin\nt64;
C:\altera\12.1\quartus\bin64
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
Using any of these commands without the pipe works fine, and redirecting to/from file works fine too. The programs appear to be exiting correctly as there is nothing appearing in any of the event logs.
Does anyone know what might be the cause of such an issue?
you have here the default ComSpec value: "COMSPEC=C:\WINDOWS\system32\cmd.exe" , take from https://stackoverflow.com/questions/2276483/what-should-comspec-and-path-environmental-variables-be-to-locate-the-command-in
– higuita – 2014-12-11T16:09:54.6802It doesn't even need to be defined to look like a value suitable for PATHEXT. As long as the path to cmd.exe is not specified properly that error occurs. Good catch! +1 – Karan – 2013-02-26T02:03:47.367
1@Karan -Oooh, interesting. I never thought to test until your comment, but on Vista, I get the same error message if ComSpec is defined, but does not point to a valid executable. My CMD session crashes if ComSpec is not defined at all. – dbenham – 2013-02-26T02:11:01.407
Great answer, thanks! Solved the problem. I'd upvote you if I had enough rep. – marcush – 2013-02-26T02:13:22.647
1@Karan, I modified the answer to reflect your discovery. Thanks. – dbenham – 2013-02-26T02:15:47.797
@marcush: one more upvote for you and you can upvote the answer, too. – 0xC0000022L – 2013-02-26T02:27:26.547
You saved my day - I signed up to SuperUser only to upvote you! – FrVaBe – 2013-04-30T09:14:51.357