in reply to system command can't spawn cmd.exe

I'm running Strawberry on XP and out of the blue, with no interactions, I started getting this error on all my system calls and backtik calls. Re-installed Strawberry and everything. So the issue ended up being a duplicate path setting in my windows environment variables. There's a 'system' path and a per user path. Basically the fix is (in XP) right click on my computer -> properties -> Advanced tab -> environment variables. Copy the system PATH variable in the bottom pane to the user one in the top pane, or append it to the one in the top pane. That was my solution and had nothing to do with directory path. Though yours may be a combination of both as the path isn't enclosed in quotes. escape some quotes inside the variable and do the PATH variable thing.

Replies are listed 'Best First'.
Re^2: system command can't spawn cmd.exe
by maq_5_Mendoza (Initiate) on Sep 08, 2011 at 19:10 UTC
    I had this issue with some perl scripts I had inherited at work (activeperl 5.6 on server 2003). It turned out to be the way the script was being called from the command line (scheduled .cmd file). e.g. c:\scripts>script.pl (resulted in the can't spawn message) however specifying perl before calling the script which is best practice anyway allowed it to work fine: c:\scripts>PERL script.pl (allows the command line call from within the perl script to work fine).
      Fixed on Windows 7, 64 bits command prompt adding the cmd.exe path in PATH like this: set PATH=%PATH%;C:\Windows\SysWOW64
        Yes this path setting works on Windows 7, 64 bit. Thanks for the this hint Fairoz.