No problems here, even with the annoying windows long file name with spaces. The programs starts, the file is loaded, when i close the program I return to the shell and there are no errors. I've been using system this way for a long time and never seen a problem. Of course this is a gui program and doesn't even require cmd, so maybe in some weird way it's skipping right over it. However I can successfully run all kinds of cmd programs, for example:#! /usr/bin/perl use warnings; use strict; my $test = "/C \"C:\\Program Files (x86)\\Microsoft Office\\OFFICE11\\ +EXCEL.EXE\" C:\\test.xls"; system ("cmd",$test);
Now what doesn't work:my $testfile = "fromdos"; my $test = "/C ${testfile} test.txt"; system ("cmd", $test);
Now when this fails I get the classic "Can't spawn "cmd": Bad file descriptor at temp2.plx line 11." Line 11 being the system call. The test executable is in the directory with the perl script which calls it, and it requires the arguments listed in order to run. Run it does. However after the expected output I get the error. Even more strange is when I do this I get the same error:#! /usr/bin/perl use warnings; use strict; my $testfile = "resultset.exe"; my $test = "/C ${testfile} localhost root pwd"; system ("cmd", $test);
In this case I'm not even asking it to start cmd.exe, but yet it's telling me that it can't spawn it. Again, the executable runs and gives me it's output, but then I get the error. cmd.exe is in system32 where it should be and system32 is in my path (proven by the fact that the first code ran fine). The executable is in the same directory as this perl script. Thinking that this might be some weird sort of 32/64 bit issue, I also tried running it like this:my $test = "${testfile} localhost root pwd"; system ($test);
Same exact results. Anyone have a clue what is going on here? I think I've gone through all the usual suggestions concerning the path env and the windows/linux path variations. Nothing seems to change this behavior, and I think my first example bears out the fact that neither of these things are at the root of this. Thanks a Bunchmy $test = "/C ${testfile} localhost root pwd"; system ("C:\\WINDOWS\\SysWOW64\\cmd.exe", $test);
In reply to Can't spawn "cmd.exe": by emalossi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |