How to Run a Batch File from the Command Line on Windows

This wikiHow teaches you how to run a batch file (.BAT) from the Windows command line. You can run the program from the 'Run' dialog or by typing commands into a terminal window. Press . This opens the Run dialog.

Method 1 of 2:

Using Run

  1. Picture 1 of How to Run a Batch File from the Command Line on Windows
    Press Win+R. This opens the Run dialog.
    1. If you need to run the batch file as an administrator, see this method instead.
  2. Picture 2 of How to Run a Batch File from the Command Line on Windows
    Click Browse….
  3. Picture 3 of How to Run a Batch File from the Command Line on Windows
    Navigate to the folder that contains the batch file.
  4. Picture 4 of How to Run a Batch File from the Command Line on Windows
    Click the batch file once to select it. The file is now highlighted.
  5. Picture 5 of How to Run a Batch File from the Command Line on Windows
    Click Open. This pastes the full path to the batch file into the Run box.
  6. Picture 6 of How to Run a Batch File from the Command Line on Windows
    Click OK. The batch file will open in a terminal window and run. When it's finished running, you'll see a line at the bottom of the window that says 'Press any key to continue.'
  7. Picture 7 of How to Run a Batch File from the Command Line on Windows
    Press any key. This closes the terminal window after the command runs.
Method 2 of 2:

Using a Terminal Window

  1. Picture 8 of How to Run a Batch File from the Command Line on Windows
    Click the
    Picture 9 of How to Run a Batch File from the Command Line on Windows
    menu. It's usually at the bottom-left corner of the screen.
  2. Picture 10 of How to Run a Batch File from the Command Line on Windows
    Type cmd into the search bar. A list of matching results will appear.
  3. Picture 11 of How to Run a Batch File from the Command Line on Windows
    Right-click Command Prompt. A menu will expand.
  4. Picture 12 of How to Run a Batch File from the Command Line on Windows
    Click Run as Administrator. A confirmation message will appear.
  5. Picture 13 of How to Run a Batch File from the Command Line on Windows
    Click Yes. This opens the command line at an elevated (administrator) level.
  6. Picture 14 of How to Run a Batch File from the Command Line on Windows
    Type cd followed by full path to the folder with the .BAT file. Here's an example:
    1. If the batch file is on your desktop, type cd UsersYourLoginNameDesktop.
    2. If it's in your downloads folder, type cd UsersYourLoginNameDownloads.
    3. If you don't know what your login name is, type cd Users and press Enter to go to the Users folder, and then type dir and press Enter to see a list of logins.
  7. Picture 15 of How to Run a Batch File from the Command Line on Windows
    Press Enter. This will move you into the directory.
  8. Picture 16 of How to Run a Batch File from the Command Line on Windows
    Type the name of the batch file. For example, if it's called 'program.bat,' type program.bat.
    1. If you don't know the name, type dir and press Enter to view the files in the folder. You'll find it there.
  9. Picture 17 of How to Run a Batch File from the Command Line on Windows
    Press Enter. This runs the batch file.
Update 04 March 2020
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile