Run program in cmd windows

Last Updated :
08 Mar, 2025

Running any software on Windows is quite easy, but what if you have to run any.exe file using the CMD? The Command Prompt in Windows is a powerful, versatile tool that grants users direct access to the operating system’s core functionalities. While graphical interfaces (GUIs) simplify many tasks.

In this guide, we will walk you through the fundamentals of navigating CMD, as well as learn how to run or .exe files through CMD. You’ll also learn how to handle common challenges, such as specifying file paths with spaces, running programs as an administrator, and integrating EXE commands into scripts for batch processing.

How-to-Run-an-exe-through-CMD

How to Run an EXE file through CMD

What is .exe in Windows

In Windows, a file with the .exe extension denotes an executable file, which contains a program that the operating system can run directly. When you double-click an .exe file, Windows loads this program into memory and executes its instructions. This format is commonly used for software applications, installers, and system utilities.

How to Run .exe file through CMD

  1. Open cmd using the Run window
  2. Copy the file path from the Address bar.
  3. Paste it after the cd command to move to the directory.
  4. To open the executable use the command: start file_name.exe.
    start chrome.exe

Note: You can also use only the file_name the extension «.exe» is optional.

Your exe file will open instantly. Let’s check out these steps with a proper demonstration.

Step 1: Open CMD Using the Run window

  • Press Win + R to open the Run Dialog Box or Go to Start Menu and type «Run».
  • Now type «CMD» or «Command Prompt» and hit Enter.
Open CMD Using the Run window

Step 2: Copy the File Path From the Address bar

  • Go to File Location from the file explorer and click on the Address bar.
  • Now, make a right-click or hit Ctrl + C to copy the location on the Address bar.
Copy the File Path From the Address bar

Step 3: Type ‘cd’ Followed by File Path

  • Go to Command Prompt and use ‘cd’ command to navigate through the EXE file location and paste it along with the cd command (that you’ve copied)
  • After entering the prompt location, now replace the file path or location with it’s actual path to the folder which contains EXE file (that you want to run)
  • Hit ENTER and the path will be redirected to your desired location.
Example: cd C:\Users\GFG0388\Desktop\My folder
step-3-cd-to-the-location

Type ‘cd’ Followed by File Path

Step 4: Run an EXE File with ‘start’ Command

  • Now, use the start command to execute the required EXE file by providing the file name.
  • Replace the filename.exe with your EXE file (ensure that it should match your program’s file & name)
  • The command instantly run the executable so beware of sudden change or window pop-up.
  • Hit the ENTER key and your selected EXE file will start executing.
Example: start chrome.exe
step-4-starting-the-exe

Run an EXE File

Issues and Troubleshooting

Running executable (.exe) files through the Command Prompt (CMD) in Windows can sometimes present challenges. Here are common issues you might encounter and their potential solutions:

Executable Not Found: If you receive an error indicating that the executable isn’t recognized, it might be due to the system not knowing where to find the file.

Solution: Navigate to the directory containing the executable using the cd command before running it. Alternatively, add the executable’s directory to the system’s PATH environment variable to allow it to be run from any location.

Corrupted File Association: Sometimes, .exe files might not open correctly due to corrupted registry settings or interference from third-party applications or malware.

Solution: Modify the registry to restore the default configuration for running .exe files. Detailed instructions can be found in Microsoft’s support article.

Insufficient Permissions: Certain executables require administrative privileges to run.

Solution: Run the Command Prompt as an administrator by right-clicking on the CMD shortcut and selecting «Run as administrator.» Then, execute the .exe file.

Executable Opens and Closes Immediately: Some console applications might execute and close too quickly to read any output.

Solution: Run the executable directly within the Command Prompt to keep the window open and view the output. Alternatively, create a batch file that runs the executable followed by the pause command to prevent the window from closing immediately.

Command Prompt Not Working: If CMD itself isn’t functioning correctly, it can hinder running executables.

Solution: Troubleshoot the Command Prompt by restarting your computer, checking for system file corruption using tools like SFC (System File Checker), or modifying environment variables. A comprehensive guide is available to address this issue.

System Conflicts or Malware: Malware or system conflicts can prevent executables from running properly.

Solution: Perform a thorough malware scan using reputable antivirus software. Additionally, consider restoring your system to a previous state using System Restore if the problem started recently.

Conclusion

Being able to run an exe through CMD gives you greater control over your applications and can simplify certain tasks that might be cumbersome through a graphical interface. By following the steps outlined in this guide, you’ll be able to confidently execute exe files using Command Prompt in various scenarios, whether you’re running a setup program, launching a game, or automating a task.

Also Read

  • How to Execute C# Program on cmd (command-line)?
  • How to Abort a Command Execution in Command Prompt?
  • How to Find the Wi-Fi Password Using CMD in Windows 11/10?

Загрузить PDF

Загрузить PDF

Из данной статьи вы узнаете, как на компьютере с Windows запустить программу из командной строки. Запустить можно программу, которая хранится в папке, созданной Windows (например, на рабочем столе). Также папку с программой можно добавить в список командной строки, чтобы запустить эту программу из командной строки.

  1. Step 1 Откройте меню «Пуск» icon.

    Щелкните по логотипу Windows в нижнем левом углу экрана. Или нажмите клавишу Win на клавиатуре.

    • В Windows 8 передвиньте указатель мыши в верхний правый угол экрана, а затем щелкните по значку в виде лупы.
  2. Step 2 В строке поиска меню «Пуск» введите командная строка.

    Отобразится значок командной строки.

  3. Step 3 Щелкните по значку командной строки icon.

    Он находится в верхней части меню «Пуск». Откроется окно командной строки.

    • Если вы вошли в систему в качестве гостя, окно командной строки не откроется.
  4. Step 4 В командной строке введите start .

    После команды start обязательно поставьте пробел.

  5. Step 5 Введите имя программы в командной строке.

    Имеется в виду системное имя программы, а не имя ее ярлыка (например, системное имя командной строки: cmd). Ниже приведены системные имена основных программ:

    • Проводник: explorer
    • Блокнот: notepad
    • Таблица символов: charmap
    • Paint: mspaint
    • Командная строка (новое окно): cmd
    • Windows Media Player: wmplayer
    • Диспетчер задач: taskmgr
  6. Step 6 Нажмите ↵ Enter.

    Введенная команда должна выглядеть примерно так: start имя_программы. Указанная программа будет запущена в течение нескольких секунд после исполнения команды «start».

    • Если выбранная программа не запустилась, скорее всего, она не включена в список программ командной строки. В этом случае перейдите к следующему разделу.

    Реклама

  1. Step 1 Откройте меню «Пуск» icon.

    Щелкните по логотипу Windows в нижнем левом углу экрана. Или нажмите клавишу Win на клавиатуре.

  2. Step 2 Откройте Проводник icon.

    Для этого щелкните по значку в виде папки в нижней левой части окна «Пуск».

  3. Step 3 Откройте папку, в которой находится программа.

    Перейдите в папку с файлами программы, которую нужно открыть.

    • Когда значок программы, которую необходимо запустить с помощью командной строки, отобразится в окне Проводника, значит, вы — в нужной папке.
    • Если вы не знаете, где находится программа, поищите ее в папке «Program Files» на жестком диске или воспользуйтесь строкой поиска (сверху).
  4. Step 4 Выделите путь к папке с программой.

    Щелкните по правой стороне адресной строки, которая находится в верхней части окна Проводника. Содержимое адресной строки будет выделено синим маркером.

  5. Step 5 Скопируйте путь к папке.

    Для этого нажмите Ctrl+C.

  6. Step 6 Щелкните по Этот ПК.

    Эта папка находится в левой части окна Проводника.

  7. Step 7 Еще раз нажмите Этот ПК.

    Так будет отменено выделение любой папки внутри папки «Этот ПК», что позволит открыть свойства папки «Этот ПК».

  8. Step 8 Щелкните по Компьютер.

    Это вкладка находится в верхней левой части страницы. Откроется панель инструментов.

  9. Step 9 Нажмите Свойства.

    Значок этой кнопки имеет вид белого квадрата с красной галочкой. Откроется всплывающее окно.

  10. Step 10 Нажмите Дополнительные параметры системы.

    Эта ссылка находится в верхней левой части окна. Откроется другое всплывающее окно.

  11. Step 11 Щелкните по вкладке Дополнительно.

    Она находится в верхней части окна.

  12. Step 12 Нажмите Переменные среды.

    Эта опция находится в нижней части окна. Откроется другое окно.

  13. Step 13 Щелкните по Path (Путь).

    Эта опция находится в окне «Системные переменные» в нижней части страницы.

  14. Step 14 Нажмите Изменить.

    Эта опция находится в нижней части страницы.

  15. Step 15 Нажмите Создать.

    Эта опция находится в верхней правой части страницы «Изменить».

  16. Step 16 В окне «Путь» вставьте путь к нужной программе.

    Для этого нажмите Ctrl+V.

  17. Step 17 Щелкните по OK.

    Вставленный путь будет сохранен.

  18. Step 18 Откройте окно командной строки (читайте предыдущий раздел).

  19. Step 19 Откройте путь к программе.

    Введите cd в командной строке, затем поставьте пробел, нажмите Ctrl+V, чтобы ввести путь к программе, а потом нажмите Enter.

  20. Step 20 В командной строке введите start .

    После команды start обязательно поставьте пробел.

  21. Step 21 Введите имя программы.

    Введите имя программы так, как оно отображается в папке с программными файлами, а затем нажмите Enter. Программа будет запущена.

    • Если в названии программы есть пробелы, вместо них введите знак подчеркивания «_» (например, system_shock, а не system shock).

    Реклама

Советы

  • Чтобы открыть любую программу с помощью командной строки, устанавливайте программы в папку «Документы».

Реклама

Предупреждения

  • Если у вас нет административного доступа к компьютеру, возможно, у вас не получится открыть окно командной строки или внести изменения в настройки пути.

Реклама

Об этой статье

Эту страницу просматривали 469 825 раз.

Была ли эта статья полезной?

  • Home
  • News
  • How to Run Program from CMD (Command Prompt) Windows 10

By Alisa |
Last Updated

You can run a program or an exe file from Command Prompt. Check how to do it in this tutorial. MiniTool software, not only provides many useful computer solutions, but also provides users many useful computer software like data recovery program, disk partition manager, system backup and restore software, video editor, etc.

If you want to run program from CMD (Command Prompt) on Windows 10, you can check the detailed steps below.

How to Run a Program from CMD in Windows 10

You can only run the applications that are installed in Windows-created folders like Explorer in Command Prompt.

Step 1. Open Command Prompt in Windows 10

At first, you should open Command Prompt application on your Windows 10 computer. You can press Windows + R, type cmd, and press Enter to open normal Command Prompt or press Ctrl + Shift + Enter to open elevated Command Prompt on Windows 10.

Step 2. Run Program from CMD on Windows 10

Next you can type start <program name> command in Command Prompt window, and press Enter to open the target application in CMD. Replace the “program name” with the exact file’s system name of the program but not its shortcut name. For instance: start explorer.

how to run a program in Command Prompt

The file’s system name of some common programs in Windows are as follows:

  • Command Prompt: cmd
  • File Explorer: explorer
  • Task Manager: taskmgr
  • Calculator: calc
  • Notepad: notepad
  • Paint: mspaint
  • Windows Media Player: wmplayer

How to Run EXE in CMD on Windows 10

You can follow the instructions below to run an exe file in Command Prompt.

Step 1. Access Command Prompt window

You can follow the same operation above to open Command Prompt in Windows 10.

Step 2. Navigate to the folder of the target program

Next you can type cd <file path> command in Command Prompt window, and press Enter to navigate to the folder that contains the target exe application. Replace “file path” with the exact file path of the exe file.

You can find the target program folder and click the address bar at the top of File Explorer window to copy the path of the program folder and paste it after cd command. For example, cd C:\Program Files\Windows Media Player.

Step 3. Run exe from CMD

After you are in the target program folder path, then you can type start <filename.exe> after the selected file path in CMD, and press Enter to run the exe file in Command Prompt. Replace “filename.exe” with the target program name, e.g. start wmplayer.exe.

how to run exe file in Command Prompt

Bottom Line

This post introduces how to run a program or exe file from CMD on Windows 10. Hope it helps.

If you need a free data recovery software to recover deleted/lost files from Windows 10 computer or other storage devices, you can try MiniTool Power Data Recovery.

MiniTool Power Data Recovery is a Windows data recovery program that allows you to recover data from PC, external hard drive HDD or SSD, USB drive, SD card, memory card, and more. It is very simple to use and 100% clean.

About The Author

Position: Columnist

Alisa is a professional English editor with 4-year experience. She loves writing and focuses on sharing detailed solutions and thoughts for computer problems, data recovery & backup, digital gadgets, tech news, etc. Through her articles, users can always easily get related problems solved and find what they want. In spare time, she likes basketball, badminton, tennis, cycling, running, and singing. She is very funny and energetic in life, and always brings friends lots of laughs.

To run a program from the Command Prompt (cmd), simply type the program’s executable name, followed by any necessary flags or arguments.

Here’s a code snippet illustrating how to run a program called `example.exe`:

C:\Path\To\Your\Program\example.exe

Understanding CMD Basics

What is CMD?

The Command Prompt, commonly referred to as CMD, is a powerful command-line interpreter in Windows. It allows users to execute commands that interact directly with the operating system. Unlike graphical user interfaces (GUIs), CMD requires the user to input text commands, making it a highly efficient tool for advanced users.

Why Use CMD to Run Programs?

Using CMD to run a program offers several advantages:

  • Speed: Executing commands in CMD can be significantly faster than using a mouse to navigate through menus and icons.
  • Automation: CMD allows users to create scripts to automate routine tasks, making it an essential tool for power users.
  • Flexibility: CMD enables users to pass command-line arguments and customize how programs run, providing more control over the execution process.

Run Services from Cmd: A Quick Guide to Command Power

Run Services from Cmd: A Quick Guide to Command Power

Preparing to Run Programs from CMD

Opening Command Prompt

Before you can run a program from CMD, you first need to open the command-line interface. There are several ways to access it:

  • Using the Start Menu: Click on the Start button, type «cmd» or «Command Prompt» in the search bar, and select the application.
  • Using the Run Dialog: Press Windows + R, type «cmd,» and hit Enter.
  • Using the Search Bar: Type «cmd» directly into the search bar on the taskbar and select the Command Prompt from the results.

Navigating to the Program’s Directory

Knowing the location of the application you want to run is crucial. If you need to navigate to its installation directory, you can use the `cd` (change directory) command.

For example, if you need to navigate to a specific folder, you can type:

cd "C:\Program Files\Example Folder"

This command will change the current directory to the specified path, making it easier to execute the program from there.

Run .exe From Cmd: Your Quick Start Guide

Run .exe From Cmd: Your Quick Start Guide

How to Run a Program Using CMD

Basic Syntax for Running a Program

To run a program or application, you can utilize the following general command structure:

start <path-to-program>

This format allows you to specify the application you want to launch.

Running a Program Directly

If the program’s executable is in your system’s PATH, you can run it simply by typing its name. For instance, to launch Notepad, you can enter:

start notepad.exe

Windows will automatically search for the executable and run it, showcasing how CMD can streamline the process of launching applications.

Specifying Full Path to a Program

In case you need to run a program that isn’t in the system PATH, providing the full path is necessary. For example:

start "C:\Program Files\ExampleApp\example.exe"

By inputting the complete path, you ensure that CMD knows exactly where to find and run the desired application.

Running a Program with Arguments

Many applications accept command-line arguments, which modify their behavior upon startup. For instance, if you want to open a specific text file in Notepad, you can include the file path as an argument:

start notepad.exe "C:\Users\Example\Documents\TextFile.txt"

By using arguments, you enhance CMD’s flexibility, allowing more customized application launches.

Run Cmd From Cmd: Your Quick Guide to Mastery

Run Cmd From Cmd: Your Quick Guide to Mastery

Common CMD Commands for Running Programs

Using the `start` Command

The `start` command is one of the most versatile tools in CMD. Apart from launching programs, it can open documents or folders. Additionally, it allows for running processes in a new command window or even in the background.

For example, to run a program in the background without blocking your CMD window, you could use:

start /min "C:\Program Files\ExampleApp\example.exe"

Using the `call` Command

The `call` command is another useful option, primarily when you want to run a batch file or another executable while still being able to return control back to the original command prompt script.

call "C:\Program Files\ExampleApp\example.exe"

This allows you to execute a program and then continue executing subsequent commands without exiting the command-line session.

Running Programs as Administrator

Sometimes, you may need to execute a program with elevated privileges. Running CMD as an administrator is essential in such cases. To do this, right-click on the CMD icon and select «Run as administrator.»

If your application requires admin rights, you can run it using:

runas /user:administrator "C:\Program Files\ExampleApp\example.exe"

This command prompts for the admin password and runs the specified program with elevated rights.

Run Files from Cmd: A Simple Guide for Everyone

Run Files from Cmd: A Simple Guide for Everyone

Troubleshooting Common Issues

Errors When Running Programs

While using CMD to run programs, you may encounter some errors. A common one is the «not recognized as an internal or external command» message. This typically indicates that your system cannot find the executable or that the command was typed incorrectly. To troubleshoot:

  • Verify the program’s name and path.
  • Ensure that you have permission to execute the application.

Checking If CMD Commands Worked

To confirm if a program opened successfully, you can check the Task Manager. Simply press Ctrl + Shift + Esc or right-click the taskbar and select «Task Manager.» Alternatively, you can utilize CMD to list running processes with the command:

tasklist

This will display all currently running applications, allowing you to verify your CMD command’s success.

Uninstall From Cmd: A Simple Step-By-Step Guide

Uninstall From Cmd: A Simple Step-By-Step Guide

Automating Tasks with CMD

Creating Batch Files

Batch files are a simple way to automate the process of running multiple commands or applications in sequence. To create a batch file, open Notepad and type your commands. For example:

@echo off
start notepad.exe
start calc.exe

Save this file with a `.bat` extension. When you double-click the file, it will execute the commands inside it sequentially.

Scheduling Programs Using CMD

To automate tasks, you can also use Windows Task Scheduler to run programs at specific times. Using CMD, you can create a scheduled task with the following structure:

schtasks /create /tn "MyProgram" /tr "notepad.exe" /sc once /st 10:00

This command sets a task named «MyProgram» to run Notepad at 10:00 AM.

Reset PC from Cmd: A Simple Guide to Get Started

Reset PC from Cmd: A Simple Guide to Get Started

Conclusion

Now that you understand how to run a program from CMD, you can utilize this powerful tool to enhance your productivity. The flexibility, speed, and automation capabilities of CMD make it an invaluable resource for anyone looking to streamline their workflow. Whether you’re launching a simple application or automating complex tasks, CMD offers countless possibilities. Embrace the command line and explore what you can achieve with it!

  • SS64
  • CMD
  • How-to

Start a program, command or batch script, opens in a new/separate Command Prompt window.

Syntax
      START "title" [/D path] [options] "command" [parameters]

Key:
   title       Text for the CMD window title bar (required.)
   path        Starting directory.
   command     The command, batch file or executable program to run.
   parameters  The parameters passed to the command.

Options:
   /MIN         Start window Minimized.
   /MAX         Start window Maximized.
   /W or /WAIT  Start application and wait for it to terminate.
                (see below)

   /LOW         Use IDLE priority class.
   /NORMAL      Use NORMAL priority class.
   /ABOVENORMAL Use ABOVENORMAL priority class.
   /BELOWNORMAL Use BELOWNORMAL priority class.
   /HIGH        Use HIGH priority class.
   /REALTIME    Use REALTIME priority class.
/B Start application without creating a new window. In this case Ctrl-C will be ignored - leaving Ctrl-Break as the only way to interrupt the application. /I Ignore any changes to the current environment, typically made with SET. Use the original environment passed to cmd.exe /NODE The preferred Non-Uniform Memory Architecture (NUMA) node as a decimal integer. /AFFINITY The processor affinity mask as a hexadecimal number. The process will be restricted to running on these processors. Options for running 16-bit Windows programs, on Windows 10 only: /SEPARATE Start in separate memory space. (more robust) 32 bit only. /SHARED Start in shared memory space. (default) 32 bit only.

Always include a TITLE this can be a simple string like «My Script» or just a pair of empty quotes «»
According to the Microsoft documentation, the title is optional, but depending on the other options chosen you can have problems if it is omitted.

If command is an internal cmd command or a batch file then the command processor CMD.exe is run with the /K switch. This means that the window will remain after the command has been run.

In a batch script, a START command without /wait will run the program and just continue, so a script containing nothing but a START command will close the CMD console and leave the new program running.

Document files can be invoked through their file association just by typing the name of the file as a command.
e.g. START «» MarchReport.docx will launch the application associated with the .docx file extension and load the document.

To minimise any chance of the wrong exectuable being run, specify the full path to command or at a minimum include the file extension: START «» notepad.exe

If you START an application without a file extension (for example WinWord instead of WinWord.exe)then the PATHEXT environment variable will be read to determine
which file extensions to search for and in what order.
The default value for the PATHEXT variable is: .COM;.EXE;.BAT;.CMD

Start — run in parallel

The default behaviour of START is to instantiate a new process that runs in parallel with the main process. For arcane technical reasons, this does not work for some types of executable, in those cases the process will act as a blocker, pausing the main script until it’s complete.

In practice you just need to test it and see how it behaves.

Often you can work around this issue by creating a one line batch script (runme.cmd ) to launch the executable, and then call that script with START runme.cmd

Start /Wait

The /WAIT option should reverse the default ‘run in parallel’ behaviour of START but again your results will vary depending on the item being started, for example:

Echo Starting
START /wait "job1" calc.exe
Echo Done

The above will start the calculator and wait before continuing. However if you replace calc.exe with Winword.exe, to run Word instead, then the /wait will stop working, this is because Winword.exe is a stub which launches the main Word application and then exits.

A similar problem will occur when starting a batch file, by default START will run the equivalent of CMD /K which opens a second command window and leaves it open. In most cases you will want the batch script to complete and then just close its CMD console to resume the initial batch script. This can be done by explicitly running CMD /C …

Echo Starting
START /wait "demojob" CMD /c demoscript.cmd
Echo Done

Add /B to have everything run in a single window.

In a batch file, an alternative is to use TIMEOUT to delay processing of individual commands.

START vs CALL

Starting a new process with CALL, is very similar to running START /wait, in both cases the calling script will (usually) pause until the second script has completed.

Starting a new process with CALL, will run in the same shell environment as the calling script. For a GUI application this makes no difference, but a second ‘called’ batch file will be able to change variables and pass those changes back to the caller.

In comparison START will instantiate a new CMD.exe shell for the called batch. This will inherit variables from the calling shell, but any variable changes will be discarded when the second script ends.

Run a program

To start a new program (not a batch script), you don’t have to use CALL or START, just enter the path/file to be executed, either on the command line or within a batch script. This will behave as follows:

  • On the command line, CMD.EXE does not wait for the application to terminate and control immediately returns to the command prompt.
  • Running a program from within a batch script, CMD.EXE will pause the initial script and wait for the application to terminate before continuing.
  • If you run one batch script from another without using either CALL or START, then the first script is terminated and the second one takes over.

Search order:

  • Running a program from CMD will search first in the current directory and then in the PATH.
  • Running a program from PowerShell will search first in the PATH and then in the current directory.
  • The Windows Run Line (win+r) will search first in App Paths [defined in HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths] and then the PATH

Multiprocessor systems

Processor affinity is assigned as a hex number but calculated from the binary positions (similar to NODRIVES)

Hex Binary        Processors
 1 00000001 Proc 1 
 3 00000011 Proc 1+2
 7 00000111 Proc 1+2+3
 C 00001100 Proc 3+4 etc

Specifying /NODE allows processes to be created in a way that leverages memory locality on NUMA systems. For example, two processes that communicate with each other heavily through shared memory can be created to share the same preferred NUMA node in order to minimize memory latencies. They allocate memory from the same NUMA node when possible, and they are free to run on processors outside the specified node.

start /NODE 1 app1.exe
start /NODE 1 app2.exe

These two processes can be further constrained to run on specific processors within the same NUMA node.

In the following example, app1 runs on the low-order two processors of the node, while app2 runs on the next two processors of the node. This example assumes the specified node has at least four logical processors. Note that the node number can be changed to any valid node number for that computer without having to change the affinity mask.

start /NODE 1 /AFFINITY 0x3 app1.exe
start /NODE 1 /AFFINITY 0xc app2.exe

Running executable (.EXE) files

When a file that contains a .exe header, is invoked from a CMD prompt or batch file (with or without START), it will be opened as an executable file. The filename extension does not have to be .EXE. The file header of executable files start with the ‘magic sequence’ of ASCII characters ‘MZ’ (0x4D, 0x5A) The ‘MZ’ being the initials of Mark Zibowski, a Microsoft employee at the time the file format was designed.

Command Extensions

If Command Extensions are enabled, external command invocation through the command line or the START command changes as follows:

Non-executable files can be invoked through their file association just by typing the name of the file as a command. (e.g. example.docx would launch the application associated with the .docx file extension). This is based on the setting in HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.ext\OpenWithList, or if that is not specified, then the file associations — see ASSOC and FTYPE.

When executing a command line whose first token is the string CMD without an extension or path qualifier, then CMD is replaced with the value of the COMSPEC variable. This prevents picking up CMD.EXE from the current directory.

When executing a command line whose first token does NOT contain an extension, then CMD.EXE uses the value of the COMSPEC environment variable. This prevents picking up CMD.EXE from the current directory.

When executing a command line whose first token does NOT contain an extension, then CMD.EXE uses the value of the PATHEXT environment variable to determine which extensions to look for and in what order. The default value for the PATHEXT variable is: .COM;.EXE;.BAT;.CMD Notice the syntax is the same as the PATH variable, with semicolons separating the different elements.

When searching for an executable, if there is no match on any extension, then looks to see if the name matches a directory name. If it does, the START command launches the Explorer on that path. If done from the command line, it is the equivalent to doing a CD /D to that path.

Errorlevels

If the command is successfully started ERRORLEVEL =unchanged, typically this will be 0 but if a previous command set an errorlevel, that will be preserved (this is a bug).
If the command fails to start then ERRORLEVEL = 9059
START /WAIT batch_file — will return the ERRORLEVEL specified by EXIT

START is an internal command.

Examples

Start a program in the current directory:

START «Demo Title» example.exe

Start a program giving a fulll path:

START «Demo 2» /D «C:\Program Files\ACME Corp\» «example.exe»

Alternatively:

START «Demo 2» «C:\Program Files\ACME Corp\example.exe»

or:

CD /d «C:\Program Files\ACME Corp\»
START «Demo 2» «example.exe»

Start a program and wait for it to complete before continuing:

START «Demo 3» /wait autocad.exe

Open a file with a particular program:

START «Demo 4» «C:\Program Files\Microsoft Office\Winword.exe» «D:\Docs\demo.txt»

Run a minimised Login script:

CMD.exe /C START «Login Script» /Min CMD.exe /C Login.cmd

In this example the first CMD session will terminate almost immediately and the second will run minimised.
The first CMD is required because START is a CMD internal command. An alternative to this is using a shortcut set to open minimised.

Open Windows Explorer and list the files in the current folder (.) :

C:\any\old\directory> START .

Open a webpage in the default browser, note the protocol is required (https://):

START
https://ss64.com

Open a webpage in Microsoft Edge:

%windir%\explorer.exe microsoft-edge:https://ss64.com
or with a hard-coded path:
«C:\Program Files (x86)\Microsoft Edge\Application\msedge.exe» https://ss64.com

"%windir%\explorer.exe shell:Appsfolder\Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge" https://ss64.com

Connect to a new printer: (this will setup the print connection/driver):

START \\print_server\printer_name

Start an application and specify where files will be saved (Working Directory):

START /D C:\Documents\ /MAX «Maximised Notes» notepad.exe

“Do not run; scorn running with thy heels” ~ Shakespeare, The Merchant of Venice

Related commands

WMIC process call create «c:\some.exe»,»c:\exec_dir» — This method returns the PID of the started process.
CALL — Call one batch program from another.
CMD — can be used to call a subsequent batch and ALWAYS return even if errors occur.
TIMEOUT — Delay processing of a batch file/command.
TITLE — Change the title displayed above the CMD window.
RUN commands Start ➞ Run commands.
How-to: Run a script — How to create and run a batch file.
How-to: Autoexec — Run commands at startup.
ScriptRunner — Run one or more scripts in sequence.
Q162059 — Opening Office documents.
Equivalent PowerShell: Start-Process — Start one or more processes.
Equivalent bash command (Linux) : open — Open a file in it’s default application.
Equivalent macOS command: open — Open a file in a chosen application.


Copyright © 1999-2025 SS64.com
Some rights reserved

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Logitech quickcam messenger драйвер windows 10
  • Javascript for windows xp
  • Поиск в центре обновления windows долго ищет драйвера
  • Razer kraken x драйвера windows 10
  • Как обновить windows 10 10240