• Welcome to Web Hosting Community Forum for Webmasters - Web hosting Forum.

Pass an argument while calling Windows batch file

Started by Chris, October 30, 2019, 05:27:43 PM

WordPress Premium Themes



I have created a batch file which performs certain task on conditions. But the conditions are being checked based on the argument we supply in a batch file. I am not sure how to pass arguments for Windows batch file and use them in conditions?



Passing an argument in a batch file is easy. For example, if your batch file name is myfile.bat and you want to pass some argument, you can execute following command:

myfile myargument

The value myargument will be stored in %1 and you can store in variable as follow:

set arg1=%1

WordPress Premium Themes