Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Suppose I have a program named any_program.exe and my operating system drive is C:. The location of the program is D:\Any_Folder\any_program.exe

How do I start/execute that program via command prompt in Windows 8?

I have tried the command line START any_program.exe, but it shows me an error that

Windows cannot find 'any_program.exe'. Make sure you typed the name correctly, and then try again.

By the way, it worked perfectly in Windows 7. And, if I type START notepad.exe or START firefox.exe (Firefox is not installed in C: drive), it works in Windows 8.

share|improve this question
    
This doesn't really have anything to do with Windows 8 in particular, does it? –  Јοеу Oct 28 '12 at 17:37
    
I guess it does. In windows 7, only the path would have worked. But in windows 8, the path of the program must be in between quotation marks (what I've found out), or it shows error that it could not locate the program (if the path isn't registered in PATH environment variable or in App registry). –  Ahmadul Hoq Oct 29 '12 at 11:08
    
@AhmadulHoq Windows 7 does behave in exactly the same way, as far as I know. You probably had the file in one of those places. –  Bob Oct 31 '12 at 3:33
add comment

6 Answers

up vote 12 down vote accepted

When you try to execute a file, either by directly calling it or with the start command, Windows must search for the file's location. There are several places it searches in the following order:

  • Current working directory
  • Windows directory
  • Windows\System32 directory
  • Directories listed in PATH environment variable
  • Registry defined App Paths

Normally, you can either navigate to the location of the file with cd /d D:\Any_Folder (/d means change drive) and just run any_program.exe. Alternatively, you can specify the full path D:\Any_Folder\any_program.exe.

If you want to start it with just any_program.exe, you have a couple of options:

  • You can put it in the Windows or System32 directories, or any directory in the PATH environment variable.
  • You can add the directory it is located in (D:\Any_Folder) to the PATH environment variable, see this question for details.
  • You can add it to the App Paths registry key, as Notepad and Firefox does. App Paths links a file keyword (such as firefox.exe) with the full path to the file, unlike the other options that deal with directories. See here for more information.
share|improve this answer
add comment
start D:\Any_Folder\any_program.exe

or, when path or file contains spaces

start "" "D:\Any_Folder\any_program.exe"

start any_program.exe works only for those programs, who are located in %PATH% environment variable, or registered in registry in the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths or its HKEY_CURRENT_USER analogue.

share|improve this answer
add comment

You have two options:

  1. Add the program to your %PATH% variable
  2. Use quotes in your shortcut

Detail:

Adding any_program.exe to path:

  1. Go to "Control Panel" ->"Advanced System Settings"
    Advanced System Settings
  2. Go to the Advanced tab
    System Settings

  3. Click on "Environment Variables" Add the folder in which any_program.exe resides. Edit the PATH Variable and add the folder in the end, separated by a ;
    path variable

  4. You can now use any_program.exe in the run dialog box (Try logging out and back to make sure your path variable changes are used.)

Using complete path

Instead of using any_program.exe in the Run dialog, you need to use the complete PATH. So type D:\Stuff\App\any_program.exe in the run dialog instead.

share|improve this answer
    
those screenshots are WAAAY to large. Mind having them at a reasonable size? –  Journeyman Geek Oct 28 '12 at 9:30
    
Working on it... –  Capt.Nemo Oct 28 '12 at 9:34
    
Path directories on Windows are delimited by semicolons (;), not colons (:)... –  Bob Oct 28 '12 at 9:39
    
I had that in my mind, but still mis-typed it. –  Capt.Nemo Oct 28 '12 at 9:42
    
Screenshots taken from c-sharpcorner.com/UploadFile/6cde20/… apparently . The screenshots there are terrible –  Journeyman Geek Oct 28 '12 at 9:52
show 1 more comment
  1. Open Command Prompt
  2. Type the name of the program you want to run. If its on the PATH System variable it will be executed. If not, you'll have to type the full path to the program. For example, to run D:\Any_Folder\any_program.exe type D:\Any_Folder\any_program.exe on the Command prompt and press Enter
share|improve this answer
    
Haha nice trick! –  Ahmadul Hoq May 1 '13 at 7:41
add comment

I am using a yet simple method . . .
Copy the shortcut of the file to C:\users\name and then type the shortcut's name in run dialog box. . . . .

share|improve this answer
add comment

I guess you have to add the path to the PATH variable in system variables

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.