Beefy Boxes and Bandwidth Generously Provided by pair Networks chromatic writing perl on a camel
Think about Loose Coupling
 
PerlMonks  

Re: system command can't spawn cmd.exe

by dbwiz (Curate)
on Jan 12, 2005 at 09:08 UTC ( [id://421603]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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 09: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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://421603]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.