C:\test>junk a string[18] = 'perl -x -S junk a ' C:\test>junk a b c d e f g h string[32] = 'perl -x -S junk a b c d e f g h ' C:\test>type junk.bat @rem = '--*-Perl-*-- @echo off if "%OS%" == "Windows_NT" goto WinNT perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9 goto endofperl :WinNT perl -x -S %0 %* if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl if %errorlevel% == 9009 echo You do not have Perl in your PATH. if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul goto endofperl @rem '; #!/usr/bin/perl -w #line 15 use Win32::API; Win32::API->Import("kernel32", "LPTSTR GetCommandLine()"); my $string = pack("Z*", GetCommandLine()); print "string[".length($string)."] = '$string'\n"; __END__ :endofperl C:\test>perl -MWin32::API -wle"print $Win32::API::VERSION" 0.41