in reply to \" on the WinXP Command Line

The perl.exe program contains common code supplied by the compiler that parses the command tail into words which it then passes to main() as argv. If you recompile perl.exe, you can change that with some effort, or ignore it with less effort: at the top of main call GetCommandLine, parse it the way you please, re-point argv to your own array. The rest of the program will be none the wiser.

But if you don't mind perl itself getting flags in its usual way, you can affect parsing of the arguments to your script from within Perl. Ignore ARGV and parse the string from GetCommandLine within the program. If it's not available already in some module, just use Win32::API to import it.

—John

Replies are listed 'Best First'.
Re: Re: \" on the WinXP Command Line
by Ardemus (Beadle) on Feb 25, 2004 at 22:22 UTC
    Thanks folks. Between your comments and a quick search (Is it possible to include GetOpt flags in $0), here is a stab at reading the command line directly:
    if ($^O=~/win/){ use Win32::API; my $GetCommandLine = Win32::API->new('kernel32', 'GetCommandLine', + [ ] , 'P' ); $cmdline = $GetCommandLine->Call(); #Parse Command Line, into @ARGV if desired }
    I haven't gotten it to work on my machine yet (the error follows), but I think that it's a configuration issue on my end. Thanks again.
    Can't locate Win32/API.pm in @INC (@INC contains: D:/Exoddus/Util/Tool +s/Scripts C:\Perl\lib C:/Perl/lib C:/Perl/site/lib .) at C:\Documents + and Settings\nburger \Desktop\PerlTemp\dirComptest.pl line 4. BEGIN failed--compilation aborted at C:\Documents and Settings\nburger +\Desktop\PerlTemp\dirComptest.pl line 4.