in reply to Using perl to output a DOS batch file
my $outfile = q{mybatchfile.bat}; open( OUTPUT, q{>}, $outfile) or die qq{Can't open file $outfile : $!\n}; { print OUTPUT qq{\@echo off\n setlocal\n set PATHNAME=C:\\TEMP\\\%1_REGRESSIO +N\n}, qq{set WAIT_TIME=240000\n set URL="http://myurl.biz"\n}, qq{set PWD="megapassword"\nset EMAIL_TO_STRING="bob@test.com"}; }
I hope this is helpful.
Update: Thinking about it, your code might be a lot clearer if you use a HEREDOC.
my $outfile = q{mybatchfile.bat}; open( OUTPUT, q{>}, $outfile) or die qq{Can't open file $outfile : $!\n}; print OUTPUT <<EOT @echo off setlocal set PATHNAME=C:\TEMP\%1_REGRESSION set WAIT_TIME=240000 set URL="http://myurl.biz" set PWD="megapassword" set EMAIL_TO_STRING="bob@test.com" EOT
Also, I should have escaped the @ in the first code sample; corrected.
Update: Corrected typo - s{qotes}{quotes}
Cheers,
JohnGG
|
|---|