Reputation: 1599
I have a command prompt shortcut that run a bat file when it's launched. Once it is launched I will issue another command,say my_command, which is added as doskey macro in login.bat
The flow is somewhat like this.
I have a cmd shortcut with target set as:
C:\Windows\System32\cmd.exe /k "D:\\login.bat"
where login.bat
sets the environment.
Once the cmd prompt is active I should issue another command, say my_command
(which should be run in the currently open cmd prompt)
Inside login.bat
I have the following lines
...
doskey my_command=another_login.bat DEBUG 32
I was trying to write a bat file to do the whole thing.
I am not supposed to change login.bat
What I tried is :
start C:\Windows\System32\cmd.exe /k "D:\\login.bat"
my_command
The command my_command
gets run on the bat file's command prompt.
How do I make the command my_commnad
run on the newly opened command prompt and not in the bat file's cmd prompt?
Upvotes: 0
Views: 1092
Reputation: 103467
Try this:
start C:\Windows\System32\cmd.exe /k "D:\\login.bat & devenv"
Answering your edit: bad news.
You cannot run a Doskey macro from a batch file.
Reference: http://ss64.com/nt/doskey.html
Can you just directly run the command you are setting up with doskey?
start C:\Windows\System32\cmd.exe /k "D:\\login.bat & another_login.bat DEBUG 32"
Upvotes: 1
Reputation: 2799
You need to specify the full path to devenv inside the batch file, and that path will depend on your version of Visual Studio.
Try replacing devenv
with one of these:
VS 2013:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe
VS 2012:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe
VS 2010:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe
The doskey.exe
executable is located in C:\Windows\System32\doskey.exe
. Referencing it by full path should work.
Upvotes: 0