How to Execute batch file from command line on Windows

Use the Run dialog box

How to Execute batch file from command line on Windows Picture 1

Press ⊞ Win+R . The Run dialog box opens.

If you want to execute the batch file as administrator then check out this method.

How to Execute batch file from command line on Windows Picture 2

Click Browse… (Browse).

How to Execute batch file from command line on Windows Picture 3

Navigate to the folder containing the batch file.

How to Execute batch file from command line on Windows Picture 4

Click on the batch file to select. The file will be highlighted.

How to Execute batch file from command line on Windows Picture 5

Click Open . The full path to the batch file will be pasted into the Run dialog box.

How to Execute batch file from command line on Windows Picture 6

Click OK . The batch file will open in a terminal window and execute. When the file finishes running, a line will appear at the bottom of the window with the content 'Press any key to continue'.

How to Execute batch file from command line on Windows Picture 7

Press any key. The terminal window will close after the command executes.

Use the Terminal window

How to Execute batch file from command line on Windows Picture 8

Click the menu, which is usually located in the lower left corner of the screen.

How to Execute batch file from command line on Windows Picture 9

Type cmdin the search bar. A list of matching results will appear.

How to Execute batch file from command line on Windows Picture 10

Right click on Command Prompt . A menu will appear.

How to Execute batch file from command line on Windows Picture 11

Click Run as Administrator . A confirmation message will appear.

How to Execute batch file from command line on Windows Picture 12

Click Yes . The administrator command line will open.

How to Execute batch file from command line on Windows Picture 13

Enter cdalong with the full path to the folder containing the .BAT file. Here is an example:

If the batch file is on your desktop, type cd UsersYourLoginNameDesktop.

If the file is in the downloads folder, enter cd UsersYourLoginNameDownloads.

If you don't know the login name, type cd Usersand click ↵ Enterto access the Users user folder, then type dirand click ↵ Enterto see the login list.

How to Execute batch file from command line on Windows Picture 14

Press ↵ Enter. You will be redirected to the folder containing the batch file.

How to Execute batch file from command line on Windows Picture 15

Enter the batch file name. For example, if the file is named 'program.bat,' you type program.bat.

If you don't know the file name, enter the command dirand click ↵ Enterto see the files in the folder. You will see the file you are looking for here.

How to Execute batch file from command line on Windows Picture 16

Press ↵ Enter. The batch file will execute.

5 ★ | 2 Vote

May be interested

  • Shift command in WindowsShift command in Windows
    shift helps to change the position of batch parameters in a batch file.
  • Rem command in WindowsRem command in Windows
    the rem command helps write comments (comments) in a batch file or config.sys.
  • Steps to set up SFC shortcut on Windows 11Steps to set up SFC shortcut on Windows 11
    system file checker is one of windows 11's most useful maintenance utilities. this command-line tool scans and repairs corrupted system files when you type and execute the sfc /scannow command. running an sfc scan can often fix windows errors and problems.
  • 5 software to rename files in batch5 software to rename files in batch
    in everyday life, being able to perform a certain action across an entire series of files or folders will increase labor productivity many times. bulk image editing is a good example of this issue. similarly, there are tools that can help you rename a batch of files at once. such applications will be incorporated in this article. we will introduce you to the best free tools for batch renaming file names in windows.
  • How to Crash Your Computer Using a Batch FileHow to Crash Your Computer Using a Batch File
    for whatever reason, you may want to crash your computer. using your pc's notepad app as a platform, you can create a simple .bat (or 'batch') file that creates an infinite loop of opening command prompt windows; this will rapidly consume...
  • How to batch rename files on Windows without softwareHow to batch rename files on Windows without software
    if you are wondering how to batch rename files on your computer, here are instructions to batch rename files using built-in tools on windows, without using batch file renaming software. invite you to follow along.
  • How to Execute Ruby CodeHow to Execute Ruby Code
    today's tipsmake will show you how to execute ruby code on windows, macos, ubuntu and debian linux. to run a ruby program, the ruby software must be pre-installed on the computer. although macos and most linux distributions come with ruby pre-installed, you need to check to make sure the current version is up to date before proceeding with the program. also, if the ruby code to deploy is written by you in a text editor or developer environment, save it as a .rb file so you can execute it from the command line.
  • Manage the Event Log with the command lineManage the Event Log with the command line
    for many of us, using the command line - command line to control and use some of the functions in the windows system will cause them to have headaches and problems. however, if you have to set up an automatic function system in windows and other server operating systems, the command line is an irreplaceable tool ...
  • Call command in WindowsCall command in Windows
    the call command calls a batch program from another program without stopping the original batch program. the call command accepts the label as its target.
  • How to Open a Command Line Program on WindowsHow to Open a Command Line Program on Windows
    tipsmake today will show you how to open the command prompt command line window on windows pc. you can open command prompt from the start menu or any folder in file explorer. besides, the windows run feature is also an option.