in reply to Re^2: Executing perl program from another perl program and capturing the output
in thread Executing perl program from another perl program and capturing the output
If ... if ... Capture::Tiny. If ... then Win32::ShellQuote ...
Just unnecessary! (Ie. A waste of time and effort.)
If the shell (cmd.exe) requires quotes ...:
C:\test>"c:\Program Files\Direct Modeling Express 4.0\binx64\7za.exe" +a -y c:\junk.rar "c:\Program Files\Hitman Pro 3.5\*" 7-Zip (A) 4.42 Copyright (c) 1999-2006 Igor Pavlov 2006-05-14 Scanning Creating archive c:\junk.rar Compressing HitmanPro35_x64.exe Everything is Ok
Then invoking the same command via the shell, via backticks also requires, (and will work with) quotes ... (but use / instead of \ for paths!)
[0] Perl> $output = `\"c:/Program Files/Direct Modeling Express 4.0/bi +nx64/7za.exe\" a -y c:/junk.rar \"c:/Program Files/Hitman Pro 3.5/*\" +`;; [0] Perl> print $output;; 7-Zip (A) 4.42 Copyright (c) 1999-2006 Igor Pavlov 2006-05-14 Scanning Updating archive c:/junk.rar Compressing HitmanPro35_x64.exe Everything is Ok
And that's *all* that is required. No ifs; no buts; learn the rules, and it just works.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Executing perl program from another perl program and capturing the output
by Anonymous Monk on Nov 25, 2014 at 04:34 UTC | |
by BrowserUk (Patriarch) on Nov 25, 2014 at 05:00 UTC |