Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Windows system command fails with error can't spawn "cmd.exe"

by techman2006 (Beadle)
on Jun 22, 2015 at 11:10 UTC ( [id://1131457]=perlquestion: print w/replies, xml ) Need Help??

techman2006 has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to use system command from a Perl script which get invoked from another program. During the execution I get error as below

Can't spawn "cmd.exe": No error at <Program>

When I run it from the cmd.exe the Perl script works fine and system command works as expected. So it seems that system command is not able to read ComSpec environment variable which has the cmd.exe path. So how I can tell system command for this environment variable.

I will update the question with sample code shortly.

Replies are listed 'Best First'.
Re: Windows system command fails with error can't spawn "cmd.exe"
by ww (Archbishop) on Jun 22, 2015 at 14:46 UTC

    You may draw some inferences (since you haven't shown the code that produces your data) from running this:

    C:\>dir CMD.exe /s

        ...and this:

    C:\>dir c:\Windows\System32\cmd.exe

    Further hint: what's your CWD when you try to spawn?

Re: Windows system command fails with error can't spawn "cmd.exe"
by Anonymous Monk on Jun 22, 2015 at 11:32 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1131457]
Approved by GotToBTru
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-03-29 01:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found