troubleshooting Question

Command Line Batch File (External Parameters [-switches])

Avatar of afrpa
afrpaFlag for United States of America asked on
Microsoft DOSWindows 7
8 Comments2 Solutions2192 ViewsLast Modified:
I have been writing batch files, and was wondering if there is a way to integrate user input by adding custom switches to batch files, so that it picks up the variables when running the batch file.  

I know you can use the set /p to prompt the user for input, but I want to be able to grab the parameters from the single command that the user inputs outside of the batch file.

For example >    From command line.

C:\> batchfile.bat -s "somevariable"

I want it to pass that "somevariabe" to the program when it runs the batch file, but don't know the syntax on how to make this opperational.

Any help/advice is appreciated.  Thanks.

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros