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.

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
add comment

2 Answers

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
add comment

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
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.