Note that this answer is tailored toward cmd batch language, the one found in Windows. You mention "DOS batch" but, based on several points, I think the former choice is a safe bet (1). If you really meant the original MS-DOS batch language, you should keep in mind that the if statement was a lot simpler, and you may need to use chunks of if ...

Understanding the Context

goto for control flow, rather than (for example ... In Windows, how do you access arguments passed when a batch file is run? For example, let's say I have a program named hello.bat. When I enter hello -a at a Windows command line, how do I let my 3 If I understand you correctly doing this in side your bat file will open Command prompt and print your message to screen.

Key Insights

cmd.exe hello world hope this helps. BAT file: Open new cmd window and execute a command in there The answers provided by both Kerrek SB and Ed Greaves will execute the target file under the admin user but, if the file is a Command script (.bat file) or VB script (.vbs file) which attempts to operate on the normal-login user’s environment (such as changing registry entries), you may not get the desired results because the environment ... How to code a BAT file to always run as admin mode? If both .bat and .cmd versions of a script (test.bat, test.cmd) are in the same folder and you run the script without the extension (test), by default the .bat version of the script will run, even on 64-bit Windows 7. A bat file has no structure...it is how you would type it on the command line.

Final Thoughts

So just open your favourite editor..copy the line of code you want to run..and save the file as whatever.bat or whatever.cmd