posted
A parameter for a batch file is passed on the command line after a space. Like let's say you wanted to pass the parameter "hello" for a batch program called Blayne.bat. On the command line, you would type: Blayne hello
In the batch file, you would reference the argument with %1. The second argument is %2, etc. Such as "echo %1."
I don't understand the first part of the question.
You'd probably be best off doing something like googling "DOS batch files."
Posts: 159 | Registered: Jun 2006
| IP: Logged |
posted
It would be helpful if you were to confirm that you are indeed working on DOS, or generally what operating system you are under.
Posts: 10645 | Registered: Jul 2004
| IP: Logged |
at a prompt and it will spit out for you a help page that documents everything you need to know.
Here's an example of a for loop I made in a batch file I use at work:
for %%I in (%UPGROOT%\5100\*) do echo DELETEFILE "..\5100\%%~nxI"; >> %S5SCRIPT%
This will enumerate all the files in the directory specified by %UPGROOT%\5100\ (where %UPGROOT% is a variable defined elsewhere), and write a line to a file (specified by %S5SCRIPT%) of the form
DELETEFILE "..\5100\filename";
(note that the filename then will NOT include the path the file was found at)
Posts: 142 | Registered: Apr 2005
| IP: Logged |
posted
Note that you should almost never write batch files nowadays unless you have to. WMI and PowerShell are better alternatives.
Posts: 37449 | Registered: May 1999
| IP: Logged |