in reply to Reading command line switches

On windows, you can use an API to retrieve the command line used to start the current process. You can get at this API through either Inline::C or Win32::API:

use Inline C => Config => BUILD_NOISY => 1; use Inline C => <<'END_C', NAME => 'junk', CLEAN_AFTER_BUILD => 0; SV *getCommandLine( ) { return newSVpv( GetCommandLine(), 0 ); } END_C print getCommandLine(); __END__ C:\test>getCmdLine.pl -x -P -Mfred /some=other "C:\Perl64\bin\perl.exe" "C:\test\getCmdLine.pl" -x -P -Mfred /some=o +ther

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: Reading command line switches
by Just in (Sexton) on Mar 16, 2011 at 02:53 UTC
    Nice one! This works for me. Thank you very much.