Access more than 9 arguments in cmd, Pass all cmd arguments from one bat to other bat

Posted: May 1, 2014 in CMD
Tags: , ,

http://stackoverflow.com/questions/8328338/how-do-you-utilize-more-than-9-arguments-when-calling-a-label-in-a-cmd-batch-scr

Use shift command 9 times to access the %10 argument as %1 and %11 argument as %2 … etc

Use %* to access all the arguments in any bat file and pass to other bat file.

Ex: Have following code in 1.bat

call 2.bat %*

Have following code in 2.bat

echo %*

echo %4

When you execute 1.bat 1 2 3 4 5 6 7 then it will display following output  ….

1 2 3 4 5 6 7

4

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s