How to use a .bat file to run other .bat(s) and ha

2019-09-12 16:18发布

问题:

    start cmd
    cd /d C:\U\O\D\L\D\M
    call runbot.bat
    cd /d C:\U\O\D\L\F
    call RunBossBot.bat

My issue is switching between cmd windows, it attempts to put everything in one window. Grateful for any help, Thanks

回答1:

start "" "c:\somewhere\runbot.bat"
start "" "c:\somewhere\RunBossBot.bat"

Starting a Program

See start /? and call /? for help on all three ways.

Specify a program name

c:\windows\notepad.exe

In a batch file the batch will wait for the program to exit. When typed the command prompt does not wait for graphical programs to exit.

If the program is a batch file control is transferred and the rest of the calling batch file is not executed.

Use Start command

start "" c:\windows\notepad.exe

Start starts a program and does not wait. Console programs start in a new window. Using the /b switch forces console programs into the same window, which negates the main purpose of Start.

Start uses the Windows graphical shell - same as typing in WinKey + R (Run dialog). Try

start shell:cache

Use Call command

Call is used to start batch files and wait for them to exit and continue the current batch file.