From the 638 diff file:/* The NT cmd.exe shell has the following peculiarity that needs + to be * worked around. It strips a leading and trailing dquote when +any * of the following is true: * 1. the /S switch was used * 2. there are more than two dquotes * 3. there is a special character from this set: &<>()@^| * 4. no whitespace characters within the two dquotes * 5. string between two dquotes isn't an executable file * To work around this, we always add a leading and trailing dqu +ote * to the string, if the first argument is either "cmd.exe" or " +cmd", * and there were at least two or more arguments passed to cmd.e +xe * (not including switches). * XXX the above rules (from "cmd /?") don't seem to be applied * always, making for the convolutions below :-( */
So if you run under 5.6.1 638, as ikegami did, you get the correct behaviour. See these tests. test.pl. Calls another perl script to echo back the arguments, with your args[ 12747] By: gsar on 2001/10/28 18 +:33:23 Log: finishing touches to system() fixes on windows: * detect cmd shell correctly even if it had full path i +n it * more quoting needed for single-arg system if the argu +ment really had multiple quoted arguments within it * be smarter about not calling the shell when the execu +table has spaces, but otherwise does not need shell involveme +nt * add a testsuite (windows-specific currently)
Test with 5.6.1 AS635my $cmd="\"C:\\progra~1\\accessories\\echo_arg.pl\" -fmt \"%[owner]p\ +" vob:."; print "$cmd\n"; print `$cmd`;
Test with 5.6.0 AS623>perl test.pl "C:\progra~1\accessories\echo_arg.pl" -fmt "%[owner]p" vob:. C:\progra~1\accessories\echo_arg.pl -fmt %[owner]p vob:.
Your double-double quoting appears to be the only workaround. That is in effect what the C code does now. - jim>C:\progra~1\perl560_623\bin\perl test.pl "C:\progra~1\accessories\echo_arg.pl" -fmt "%[owner]p" vob:. 'C:\progra~1\accessories\echo_arg.pl" -fmt "%[owner]p' is not recogni +zed as an internal or external command, operable program or batch fil +e.
In reply to Re: doublequoted commands inside backticks on windows, perl 5.6
by jimbojones
in thread doublequoted commands inside backticks on windows, perl 5.6
by emgrasso
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |