I know this sounds a dumb and simple question, but how do I put arguments in my batch file? For example, I want to be able to run some of my own batch files from the command line like:
example.bat /A /2 /F /T
--OR--
example.bat -W +E -1 -G +5
Can I please get some help on how to do this? Am I able to have -1 and +1 being opposite args (like the ATTRIB command)???
Thanks for any reply...
How do I put arguments in my batch file?
Moderator: DosItHelp
Re: How do I put arguments in my batch file?
Use the variables from %1 to %9, and SHIFT command if more than 9 arguments
-
- Posts: 5
- Joined: 07 Apr 2010 06:49
Re: How do I put arguments in my batch file?
@echo off
:lp
if "%~1"=="" goto:eof
for %%_ in (-s,-w,-t,-n,/b,/a) do (
if ["%~1"]==["%%~_"] echo You write %%~_)
shift
goto lp
with this you can do it
:lp
if "%~1"=="" goto:eof
for %%_ in (-s,-w,-t,-n,/b,/a) do (
if ["%~1"]==["%%~_"] echo You write %%~_)
shift
goto lp
with this you can do it