File tree Expand file tree Collapse file tree 1 file changed +25
-6
lines changed
Expand file tree Collapse file tree 1 file changed +25
-6
lines changed Original file line number Diff line number Diff line change @@ -367,21 +367,40 @@ private void CreateTemporaryBatchFile()
367367 if ( ! string . IsNullOrWhiteSpace ( Command ) )
368368 {
369369 sw . Write ( Command ) ;
370- }
371370
372- // Append command arguments if provided
373- if ( CommandArguments != null && CommandArguments . Length > 0 )
371+ // Append command arguments if provided
372+ if ( CommandArguments != null && CommandArguments . Length > 0 )
373+ {
374+ foreach ( string arg in CommandArguments )
375+ {
376+ sw . Write ( ' ' ) ;
377+ if ( NativeMethodsShared . IsUnixLike )
378+ {
379+ sw . Write ( EscapeArgumentForUnix ( arg ) ) ;
380+ }
381+ else
382+ {
383+ sw . Write ( EscapeArgumentForWindows ( arg ) ) ;
384+ }
385+ }
386+ }
387+ }
388+ else if ( CommandArguments != null && CommandArguments . Length > 0 )
374389 {
375- foreach ( string arg in CommandArguments )
390+ // If no Command but we have CommandArguments, treat the first argument as the command
391+ // and the rest as arguments
392+ sw . Write ( CommandArguments [ 0 ] ) ;
393+
394+ for ( int i = 1 ; i < CommandArguments . Length ; i ++ )
376395 {
377396 sw . Write ( ' ' ) ;
378397 if ( NativeMethodsShared . IsUnixLike )
379398 {
380- sw . Write ( EscapeArgumentForUnix ( arg ) ) ;
399+ sw . Write ( EscapeArgumentForUnix ( CommandArguments [ i ] ) ) ;
381400 }
382401 else
383402 {
384- sw . Write ( EscapeArgumentForWindows ( arg ) ) ;
403+ sw . Write ( EscapeArgumentForWindows ( CommandArguments [ i ] ) ) ;
385404 }
386405 }
387406 }
You can’t perform that action at this time.
0 commit comments