Page 1 of 1

How do I put arguments in my batch file?

Posted: 03 Apr 2010 20:38
by phillid
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... :?

Re: How do I put arguments in my batch file?

Posted: 03 Apr 2010 23:12
by !k
Use the variables from %1 to %9, and SHIFT command if more than 9 arguments

Re: How do I put arguments in my batch file?

Posted: 07 Apr 2010 07:47
by ---saster---
@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