In order to open a specific file - whose path is not listed in %PATH% -, you need either the full path for the file or the cmd prompt pointing to the verydirectory of this file - as you said, "change directory".
The command is CD.
For the command help, type CD /? in your cmd prompt.
It's also got a switch: /D. You use the /
D switch when you're 'traveling' from one
drive to another. If you're changing your path with a path in a variable, it is preferred to use /D.
Say you've got a README.DOCX file for a program, and say this program is under "Program Files".
You want to run this:
Code: Select all
cd "%programfiles%\[program folder]"
Quotes are optional for CD and PUSHD commands; I like to use them anyway.
Once you've got cmd pointing to the specified folder, you can run the file directly.
By default, "readme.docx" (without a 'start' in the beginning) will open the file and wait for it to close to continue the program (assuming you're running from a batch file and not from the command line).