How to Write a Batch Script

In Windows and DOS, a batch script can be thought of as a file that gives the computer many instructions in one step. A batch script can be constructed to quickly shut the computer down, run programs with special parameters, or even display a message on the screen. Create a batch script to have your computer perform several actions, or perform an action that you would otherwise have to type, when you run a single program.

Instructions

    • 1

      Hit the Windows logo and "R" keys on the keyboard simultaneously. This will bring up the "Run" dialog box. In the box, type "notepad" and hit "Enter."

    • 2

      Type "c:\Progra~1\Intern~1\iexplore.exe http://www.ehow.com" into the window. This command will open an Internet Explorer window, and Internet Explorer will browse directly to the index page of eHow upon being opened.

    • 3

      Click "File," then click "Save As."

    • 4

      Click the drop-down menu next to "Save as type," and choose "All Files."

    • 5

      Navigate to your desktop. Name the file "TestBatch.bat" and click "Save."

    • 6

      Double click the batch file. If you performed the above steps correctly, an Internet Explorer window to eHow will be opened.

Tips & Warnings

  • Anything that can be typed at the Windows command prompt can be entered into a batch script. The instructions in this article are only one example. Remember that if you would like to create a batch script that launches a program and you would like to save the batch file to a location on your computer other than that of the program, the full path to the program must be stated in the batch file as was done in this example. Long folder names generally work better if they are truncated to six characters with "~1" added to the end, such as in the example given in this article: "Program Files" became "Progra~1."

Related Searches:

References

Comments

You May Also Like

Related Ads

Featured