/* 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 dquote * 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.exe * (not including switches). * XXX the above rules (from "cmd /?") don't seem to be applied * always, making for the convolutions below :-( */ #### [ 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 in it * more quoting needed for single-arg system if the argument really had multiple quoted arguments within it * be smarter about not calling the shell when the executable has spaces, but otherwise does not need shell involvement * add a testsuite (windows-specific currently) #### my $cmd="\"C:\\progra~1\\accessories\\echo_arg.pl\" -fmt \"%[owner]p\" vob:."; print "$cmd\n"; print `$cmd`; #### >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:. #### >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 recognized as an internal or external command, operable program or batch file.