Batch files : How to leave the console window open

后端 未结 9 1163
星月不相逢
星月不相逢 2020-12-04 16:16

I have two batch files, one of them executes another, i.e.

  1. \"My Batch File\" > 2. \"Some Other Batch File\"

I\'ve created a shortcut of the firs

9条回答
  •  Happy的楠姐
    2020-12-04 16:37

    If that is really all the batch file is doing, remove the cmd /K and add PAUSE.

    start /B /LOW /WAIT make package
    PAUSE
    

    Then, just point your shortcut to "My Batch File.bat"...no need to run it with CMD /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.

    1. First, pin a shortcut for CMD.EXE to the taskbar by hitting the start button, then type "cmd" in the search box, right-click the result and chose "Pin to Taskbar".
    2. Right-click the shortcut on the taskbar.
    3. You will see a list that includes "Command Prompt" and "Unpin this program from the taskbar".
    4. Right-click the icon for CMD.EXE and select Properties.
    5. In the box for Target, go to the end of "%SystemRoot%\system32\cmd.exe" and type " /C " and the path and name of the batch file.

    For your purposes, you can either:

    1. Use /C and put a PAUSE at the end of your batch file.

      OR

    2. Change the command line to use /K and remove the PAUSE from your batch file.

提交回复
热议问题