I have two batch files, one of them executes another, i.e.
- "My Batch File" > 2. "Some Other Batch File"
I've created a shortcut of the first batch file and edited its properties to call its in following way.
cmd.exe /k "<SomePath>\<My Batch File>.bat" & pause
What i want to do
I want the console window to be open after the execution of the batch file is over. Now it just closes, tried to play around the cmd flags, no result.
Platform : Windows7
UPDATE 1
Modified the structure, the simple example like this does not work as well,
Only one batch file i.e. there is no the 2. "Some Other Batch File"
The only batch file contains smth like this
start /B /LOW /WAIT make package
cmd /K
UPDATE 2
The same shortcut which is invoked from Explorer does not close the console window.
But the console window closes when the shortcut is invoked from the pinned item on taskbar
Any ideas how to keep the console window open?
Best Answer
If that is really all the batch file is doing, remove the
cmd /K
and addPAUSE
.Then, just point your shortcut to
"My Batch File.bat"
...no need to run it withCMD /K
.UPDATE
Ah, some new info...you're trying to do it from a pinned shortcut on the taskbar.
I found this, Adding Batch Files to Windows 7 Taskbar like the Vista/XP Quick Launch, with the relevant part below.
For your purposes, you can either:
Use
/C
and put aPAUSE
at the end of your batch file.OR
/K
and remove thePAUSE
from your batch file.