Windows – I can’t run .bat and .cmd files with start command (Windows 7)

batchbatch filecommand linewindowswindows 7

I can run .bat and .cmd files typing his names in windows console, but if I run with start "" file.bat I get this error: System can't run specified program.

I have tested with a very simple file test.bat with this content:

echo "hola"

And running:

start "" test.bat

Without success.

If I run just test.bat it works perfectly. Also work with cmd /c test.bat and cmd /k test.bat. Running .exe files with start command is also working good.

Many months ago I had installed ansicon (https://github.com/adoxa/ansicon) and have not problems.

Some days ago I had also installed consolez (https://github.com/cbucher/console/releases) and maybe I have broken something, but I don't know where start to find. I'm testing from cmd.exe command line, not from ConsoleZ.

I can't run a restore point because I have an SSD hard drive and disabled Restore Points.

Best Answer

It sounds like your COMSPEC variable is corrupted. On my Windows 7 machine I have ComSpec=C:\Windows\system32\cmd.exe. A corrupted COMSPEC value will also prevent pipes from working.

Related Question