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

Recommended Providers

Fully Managed WordPress Hosting
lc_banner_leadgen_3
Fully Managed WordPress Hosting

WordPress Theme

Divi WordPress Theme
WPZOOM

Recent Topics

Forum Membership

Forum Membership

Pass an argument while calling Windows batch file

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

Chris

Hi,

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?

Thanks!

Kailash

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