我想从命令提示符在我的 Windows 机器上运行三台服务器。为此,我想编写一个批处理文件来运行这些打开的三个不同的命令提示符。
3 回答
To generate 3 new CMD windows that remain open, use the following command syntax:
start "application1" cmd.exe /k dir *.exe
start "application2" cmd.exe /k dir *.xml
start "application3" cmd.exe /k dir *.bat
Where the command after /k
is whatever application command line that you want to launch.
Replace the "application#" with some TITLE for the window, that makes sense for you (otherwise it will just say something like C:\Windows\System32\CMD.exe).
The windows will stay open, but that doesn't mean your application will still be running. Like the Dir
examples above, it may end but the window will remain.
The full command syntax for START is found here.
The full command syntax for CMD is found here.
为什么要分批?
如果可以的话,我最好的建议是放弃批处理并下载 cygwin 以改用 bash。
您会发现 bash 更加灵活、使用(这意味着您更有可能从其他人那里获得支持)和支持。
我是 Windows 用户,前段时间尝试学习批处理,但真的很沮丧。bash 更加用户友好。
这应该做你想做的
start application1
start application2
start application3
这将启动 3 个应用程序,这些应用程序将使用 3 个不同的命令提示符打开,它们是否会继续运行取决于应用程序。