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
-
How to Run a Batch File from the Command Line on Windows Picture 1
Press ⊞ Win+R. This opens the Run dialog.- If you need to run the batch file as an administrator, see this method instead.
-
How to Run a Batch File from the Command Line on Windows Picture 2
Click Browse…. -
How to Run a Batch File from the Command Line on Windows Picture 3
Navigate to the folder that contains the batch file. -
How to Run a Batch File from the Command Line on Windows Picture 4
Click the batch file once to select it. The file is now highlighted. -
How to Run a Batch File from the Command Line on Windows Picture 5
Click Open. This pastes the full path to the batch file into the Run box. -
How to Run a Batch File from the Command Line on Windows Picture 6
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.' -
How to Run a Batch File from the Command Line on Windows Picture 7
Press any key. This closes the terminal window after the command runs.
Method 2 of 2:
Using a Terminal Window
-
How to Run a Batch File from the Command Line on Windows Picture 8
Click theHow to Run a Batch File from the Command Line on Windows Picture 9
-
How to Run a Batch File from the Command Line on Windows Picture 10
Type cmd into the search bar. A list of matching results will appear. -
How to Run a Batch File from the Command Line on Windows Picture 11
Right-click Command Prompt. A menu will expand. -
How to Run a Batch File from the Command Line on Windows Picture 12
Click Run as Administrator. A confirmation message will appear. -
How to Run a Batch File from the Command Line on Windows Picture 13
Click Yes. This opens the command line at an elevated (administrator) level. -
How to Run a Batch File from the Command Line on Windows Picture 14
Type cd followed by full path to the folder with the .BAT file. Here's an example:- If the batch file is on your desktop, type cd UsersYourLoginNameDesktop.
- If it's in your downloads folder, type cd UsersYourLoginNameDownloads.
- 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.
-
How to Run a Batch File from the Command Line on Windows Picture 15
Press ↵ Enter. This will move you into the directory. -
How to Run a Batch File from the Command Line on Windows Picture 16
Type the name of the batch file. For example, if it's called 'program.bat,' type program.bat.- If you don't know the name, type dir and press ↵ Enter to view the files in the folder. You'll find it there.
-
How to Run a Batch File from the Command Line on Windows Picture 17
Press ↵ Enter. This runs the batch file.
5 ★ | 1 Vote
You should read it
- Instructions for creating and using BAT file on Windows
- How to Delete a File in Microsoft Windows Using Batch Files
- 5 software to rename files in batch
- How to Write a Batch File
- How to Run a BAT File on Windows
- How to move files by type in Windows with batch files
- How to batch rename files on Windows without software
- 5 IF commands help use Batch script smarter
- Top 5 software for fast batch file renaming
- How to Crash Your Computer Using a Batch File
- Press type in C
- How to use File Converter to batch convert files from the right-click menu