Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: error: can't spawn "cmd.exe"

by Athanasius (Archbishop)
on Jul 13, 2015 at 08:13 UTC ( [id://1134462]=note: print w/replies, xml ) Need Help??


in reply to error:cant spawn "cmd.exe"

Hello mrityunjaynath,

To elaborate a little on Anonymous Monk’s answer: the call to `qcmd.bat $toplevelentity` is itself “interpolated and then executed as a system command with /bin/sh or its equivalent.” (perlop) The standard output of this command is then passed to system, which attempts to run this “command” (whatever it is) as another system call. As Anonymous Monk says, you need double quotes (or qq()) here, not backticks (qx()). Alternatively, drop the call to system and just use the backticks:

if ($choice eq "y") { `qcmd.bat $toplevelentity`; } else {

But note that, in this case, the (standard) output of the system call will be thrown away, unless you explicitly assign it to a variable or print it. If you call system, standard output goes to the console and only the command’s exit status is returned to the Perl script.

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Replies are listed 'Best First'.
Re^2: error: can't spawn "cmd.exe"
by mrityunjaynath (Acolyte) on Jul 13, 2015 at 08:40 UTC

    thanks Athanasius ....your suggestions worked. I have applied ""(double quotes) and everything worked fine.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-24 04:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found