more useful options | |
PerlMonks |
(Windows) verbatim command line arguments inside Perl scriptby LanX (Saint) |
on Apr 16, 2021 at 12:37 UTC ( [id://11131372]=perlquestion: print w/replies, xml ) | Need Help?? |
LanX has asked for the wisdom of the Perl Monks concerning the following question:
Hi I need to write a Perl script which is generating a .bat-file while passing it's command line arguments 1-to-1 Is there any way to access the "raw" command-line in order to catch quoting and escaping? To highlight the problem:
As you can see are all quotes and escapes lost while calling Perl (for good reasons) But my script has to generate another .bat which does
Typical edge-case justifying this problem are win-paths with whitespace, but cmd.exe has also some arcane escaping rules. I already have a workaround: I discovered that .bat has %* to hold the verbatim command line arguments, and came up with a workaround of a .bat calling my perl-script
Question: any better solution?
Cheers Rolf PS: I don't think this question is overly Win specific, when creating a bash script on Linux I'd face the same problem.
Back to
Seekers of Perl Wisdom
|
|