0

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?

2 Answers 2

4

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

0
0

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)

You must log in to answer this question.

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