rovf has asked for the wisdom of the Perl Monks concerning the following question:
My application generates at run time a Windows BAT file (oh you wonderful Windows Batch language - if I only knew which insane person had invented it!), which then in turn calls other programs (some compiled C application, some Perl programs). I need to pass strings from my Perl application via the Batch file to these programs (using the environment is no option here). For example:
That's the basic idea. Of course it is not so easy, because I don't know the content of $some_argument until at run-time, and this means I have to generate the argument in a way which is properly quoted according to Batch Language Syntax Rules.my $some_argument='abc'; # ... $batchfile=IO::File->new(">x.bat"); print $batchfile "\@echo off\nMyProg $some_argument\n"; $batchfile->close; # ... later, in a different process ... : system("x.bat"); # executes MyProg abc
I researched a bit how to do proper quoting in Windows batch files, and though a found a bit of information here and a bit of information there, I could not find a concise document which really describes it properly. So my first question is:
Does someone happen to know a CPAN module which implements Windows Batch Language quoting? Otherwise, does someone know the rules, so that I can implement it myself? So far, I found the following set of rules:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Windows quoting
by BrowserUk (Patriarch) on Jul 21, 2008 at 14:46 UTC | |
by rovf (Priest) on Jul 22, 2008 at 08:31 UTC | |
|
Re: Windows quoting
by InfiniteSilence (Curate) on Jul 21, 2008 at 13:42 UTC | |
by rovf (Priest) on Jul 21, 2008 at 13:56 UTC | |
|
Re: Windows quoting
by pc88mxer (Vicar) on Jul 21, 2008 at 14:19 UTC | |
by rovf (Priest) on Jul 22, 2008 at 08:19 UTC |