Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Because it's actually as simple as:

    "%~dp0perl.exe" -x -S "%~f0" %*

    The quotations and "%~f0" are needed in case batch file is in a directory with whitespaces.

  • I'm "stuck" with just a MacBook in Europe right now, so I can't easily test this, but when i was playing around with this last time I noticed that there were several bugs in cmd.exe that prevented the %~ expansion from working correctly. Things like invoking the batch file and explicitly specifying the .bat extension and/or putting quotes around the command name.

    You can find my earlier attempt here: http://groups.google.com/group/perl.perl5.porters/msg/b1880b658b5ab73f [google.com]

    It worked for all the test cases

  • Batch certainly sucks, it even has two(!) incomplete sets of escaping rules.

    So instead of that complete and utter mess, why not use Windows Scripting Host [wikipedia.org]? That sounds a lot easier.

    • A very long ago, when I needed to automate things and didn't know .net/perl/python I was using WSH (via its javascript), and I must say it sucks even more. Especially since windowed/console mode is a global setting, plus it had some funny glitches in child processes execution. So, batch files are much better.