@ECHO OFF SetLocal EnableDelayedExpansion set ARGS= :parse_args if not %1.==. ( set ARG=%1 set ARGS=!ARGS! ^"!ARG:"=\"!^" shift goto :parse_args ) call perl getargs.pl %ARGS% #### unshift(@ARGV,$0); for my $n (0..$#ARGV) { print "$n:$ARGV[$n]:\n" } #### C:\>parseargs.bat "abc "" def" bob 0:getargs.pl: 1:"abc "" def": 2:bob: #### unshift(@ARGV,$0); @ARGV = map {s/^"(.*)"$/$1/ ? s/""/"/g && $_ : $_ } @ARGV; for my $n (0..$#ARGV) { print "$n:$ARGV[$n]:\n" } #### 0:getargs.pl: 1:abc " def: 2:bob: