user1236048
user1236048

Reputation: 5602

Run command on Command Prompt start

Is there a way to run any command (eg: cd D:\test) on Command Prompt start and to have this instance of Command Prompt as a different shortcut/instance.

Upvotes: 0

Views: 240

Answers (1)

Damien_The_Unbeliever
Damien_The_Unbeliever

Reputation: 239636

You can create a shortcut that has a target of e.g.:

%comspec% /k ""C:\Full_Path_to\VsDevCmd.bat""

Where the .bat file is the command(s) that you want to run on startup. This will then leave you with an open command prompt after those commands have executed.

(In case it's not obvious, this is just shamelessly ripped from one of the Developer Command Prompt shortcuts that Visual Studio installs in the Start Menu)


%comspec% is a nice way of getting cmd to execute.

Cmd:

/k : Carries out the command specified by string and continues.

Upvotes: 2

Related Questions