in reply to Improper escaping error when executing system command
A useful thing to know when constructing strings for use with system on win32 is qq operator.
Using the qq// quoting operator removes the need for escaping your double quotes whilst retaining interpolation (substitution). You will still need to double your backslashes though.
Although perl lets you get away with using forward slashes for most everything internally, many external commands, and all those built into cmd.exe (dir type rename cd rd etc.) don't work with forward slashes in paths.
system qq[ dir "d:\\program files\\win*.*" ]; my $src = "d:\\program files\\*.*"; system qq[ xcopy /s "$src" x: ];
This avoids most of the need for most backwacking and makes thing clearer to read.
|
|---|