How to run program from another folder in command prompt

Solution 1:

E:\folder name\prgm.exe works if the folder name has no space in it.

Either:

  1. Rename the folder so it has no space.
  2. Use quotes. (e.g. "E:\folder name\prgm.exe")
  3. Or add E:\folder name to the path.

Use option 3) if it is an often used program.
Use option 2) for single or rare invokations.

Solution 2:

Just a small addition to what has been answered. If there is a flag or an option to the command it would have to be outside of the quotation marks example, from you blah blah folder

E:\blah\blah>"E:\folder name\prgm.exe" -t -l 1000

Solution 3:

Just for completeness' sake, I would like to note that in addition to Hennes' answer, there is a fourth option, though in fact you might find it too similar to cd:

Enter pushd E:\folder name and your working directory changes to the specified drive and folder (no quotes required) in one easy step; returning to the previous working directory is a no-brainer as well with a simple popd