Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

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

by techman2006 (Beadle)
on Jun 22, 2015 at 11:10 UTC ( #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 rifling through the Monastery: (9)
As of 2023-12-07 20:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (33 votes). Check out past polls.

    Notices?