Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I try to run the following code:

`C:\WINNT\System32\cmd.exe /k cd "C:\page\app" & start1.bat

it throws the following error message:

The system cannot find the path specified. 'start1.bat' is not recognized as an internal or external command, operable program or batch file.

What can I do to fix this?

share|improve this question

How about you put the CD in the batch file and call it using

C:\WINNT\System32\cmd.exe /k "C:\page\app\start1.bat"

To make the batch file use a random path, you could add this for the cd:

cd %~dp0

It will cd to whatever the calling path is

share|improve this answer

Just wrap the whole value of /k parameter in double quotes and it will work:

C:\WINNT\System32\cmd.exe /k "cd /d C:\page\app & start1.bat"

I added /d switch after cd to make sure it also changes the current drive, not only current directory on C drive (see `cd` doesn't change directory in Windows 7)

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .