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

Are you sure that your file is really there?

Writing Windows path names correctly can be tricky sometimes. Try this one:

#!/usr/bin/perl -w use strict; my $prog = "c:\\program files\\agent\\agent.bat"; if (-f $prog) # does it exist? { system("cmd.exe", "/C", $prog); } else # if not, let's see its name after escaping "\"s { warn "batch file ($prog) not found!\n"; }

Replies are listed 'Best First'.
Re^2: system command can't spawn cmd.exe
by cormanaz (Deacon) on Jan 12, 2005 at 14:31 UTC
    I get the same result: Can't spawn "cmd.exe": No such file or directory. This makes me wonder if perl has the right path for cmd.exe. But then if I put a .bat file in the same directory as my perl script, it runs just fine! Very strange.

    And as for the other suggestion about running as admin, my account is not literally admin but it is a member of the admin group and I have full admin privileges.

    Steve