My program opens nicely with a Windows 7 shortcut. I want that in a batch file. Contents of shortcut [full path] copied into *.bat opens program minus needed hidden parameters.

I tried preceding with "CD" and "CD /d" to folder, but no folder change. Manually changing to program folder, and copy of *.bat, then program works.

The CD does work in a command-prompt box.

Your posts about "CD /D %~dp0" don't teach me enough.

  • Does the path name contain spaces, and if so, are you surrounding it in quotes? – Majenko Apr 23 '11 at 17:39

Well, try that:

cd %programfiles%


cd "c:\program files (x86)"


cd "c:\program files"

Remember that if you are running from a different drive, you must change it in the batch, simply writing that before or after cd command:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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