kumar gtg
kumar gtg

Reputation: 51

Batch file which executes an exe from a specific path

I am trying to create a batch file which runs an exe from a specific path. Eg: I have my exe in E drive. Exact path is E:\kk.exe. I want to run this kk.exe from D:\bin folder.

I use the following command in my batch file:

start "D:\bin" "E:\kk.exe"

So far no luck. Any help would be appreciated.

Upvotes: 0

Views: 4222

Answers (2)

MC ND
MC ND

Reputation: 70923

start "" /d "d:\bin" "e:\kk.exe"

start command has a peculiar behaviour: the first quoted argument is the title of the window. That is the reason for the initial "" (you can include the title you want). The rest of the line is the starting folder (/d, what will be the current active folder for the started process) and the command to execute.

Upvotes: 3

Magoo
Magoo

Reputation: 79983

cd /d "D:\bin"
start "window name" "E:\kk.exe"

If I've decoded your meaning correctly, you wish to run kk.exe while your current directory is d:\bin. This will create an independent process to run that program.

Note: the syntax of "start" is such that it's advisable to assign a window title (the first quoted parameter) - if you don't ant a title, leave the text out and use en empty quoted string.

However, if you just want to execute e:\kk.exe then

cd /d "D:\bin"
"E:\kk.exe"

Upvotes: 1

Related Questions