cmd.exe shortcuts and parameters

8

2

I have made a shortcut that opens cmd at a specific directroy

How can I add a program to execute at the end of this statement?

C:\Windows\System32\cmd.exe /k cd  "C:\Program Files\App" 

I have tried:

C:\Windows\System32\cmd.exe /k cd  "C:\Program Files\App" "C:\Program Files\App\app.exe"

But it doesnt work

James

Posted 2011-06-05T22:30:36.643

Reputation:

C:\Windows\System32\cmd.exe /k "ping 8.8.8.8 -t"

     As an example, adding this in the target field of the shortcut would launch ping on clicking the shortcut.
 – Martin  – 2014-08-15T04:42:24.747

Answers

14

cmd /k "command1 && command2"

Also take a look at the Microsoft documentation for the command interpreter.

rid

Posted 2011-06-05T22:30:36.643

Reputation: 602

4

C:\Windows\System32\cmd.exe /k cd  "C:\Program Files\App" & app

Since you're already in the directory there's no point in repeating it, so I just shortened your path to app. Anyways, use & to run multiple commands.

Ry-

Posted 2011-06-05T22:30:36.643

Reputation: 2 116

damn, thanks lol, I just tried && start "xxxx", didnt work, hopefully this will :) – None – 2011-06-05T22:33:00.560

@James: I've also edited, you can just use & app instead of the full path if you want. – Ry- – 2011-06-05T22:33:44.797

0

I would suggest you have cmd.exe run a script with the commands/programs you want. If it needs to be dynamic, you can make the directory name and the command to run parameters to the script.

Steve

Posted 2011-06-05T22:30:36.643

Reputation: