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.

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

share|improve this question

migrated from stackoverflow.com Jun 5 '11 at 22:43

This question came from our site for professional and enthusiast programmers.

    
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.kv Aug 15 at 4:42

3 Answers 3

cmd /k "command1 && command2"

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

share|improve this answer
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.

share|improve this answer
    
damn, thanks lol, I just tried && start "xxxx", didnt work, hopefully this will :) –  James Jun 5 '11 at 22:33
    
@James: I've also edited, you can just use & app instead of the full path if you want. –  U2744 SNOWFLAKE Jun 5 '11 at 22:33

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.