Unknow0059
Unknow0059

Reputation: 133

Batch can't find .exe files inside C:\Program Files (x86)

This is the code i'm using:

cd "D:\HigherFolder\FolderX"
start executable1.exe

cd "C:\Program Files (x86)\FolderY\"
start executable2.exe

cd "C:\Program Files (x86)\FolderZ\bin\"
start executable3.exe

exit

I want to start one .exe after the another, or at the same time, but this does not work with executables 2 and 3; command prompt says it can't find the files and that i need to certify that their names are correct (which i did, multiple times).

Upvotes: 2

Views: 2895

Answers (1)

Ken White
Ken White

Reputation: 125749

Change it to cd /d on command #2. (You can add it to commands 1 & 3 also for safety.) Your code operates on two separate drives, but CD only changes directories on the current drive without the /d switch.

cd /d "D:\HigherFolder\FolderX"
start executable1.exe

cd /d "C:\Program Files (x86)\FolderY\"
start executable2.exe

cd /d "C:\Program Files (x86)\FolderZ\bin\"
start executable3.exe

exit

Run cd /? from a command prompt for more info. An excerpt shows:

Use the /D switch to change current drive in addition to changing current directory for a drive.

Upvotes: 4

Related Questions