如何在启动程序后关闭CMD

How to Close CMD after starting an program

我写了一个批处理文件,可以在我想要的文件夹中打开两个 CMD windows,这样我就可以 运行 服务器并键入命令。我也希望能够打开firefox和sublime编辑器。

一切正常,除了我剩下 4 个 cmd windows 而不仅仅是我想要的两个。

@ECHO OFF
start cmd.exe /K "cd C:\xampp\htdocs\restful"
start cmd.exe /K "cd C:\xampp\htdocs\restful"
cd "C:\Program Files\Mozilla Firefox\"
start cmd.exe /K "firefox.exe"
cd "C:\Program Files\Sublime Text 3\"
start cmd.exe /K "sublime_text.exe"
exit

我 运行宁愿使用 Windows XP 来弥补我的过失,所以如果有人能提供帮助,我将不胜感激。

试试这个

@ECHO OFF
start cmd /K "cd C:\xampp\htdocs\restful"
start cmd /K "cd C:\xampp\htdocs\restful"

start  iexplore.exe
start  Safari.exe
exit

.

start "" "C:\users\YourUserName\Desktop\firefox.exe"
or
start "" "C:\Program Files (x86)\and Rest of the path"

一些示例: [ Link ]

START C:\MyFiles\Myletter.doc
::will open the file Myletter.doc in Word or WordPad 

START \server\printer
::will ask if you want to install the printer, install the printer driver and then connect to the network printer

START C:\WINNT\System32\ssmarque.scr /C
::will open the configuration dialogue for the 3D text screen saver, whereas

START C:\WINNT\System32\ssmarque.scr /S
::will run the screen saver itself 

START http://www.googl.com
::will open Google's search page in your browser 

START mailto:president@whitehouse.gov
::will start your e-mail program with a message addressed to...? 

应该是

@ECHO OFF
start cmd.exe /K "cd C:\xampp\htdocs\restful"
start cmd.exe /K "cd C:\xampp\htdocs\restful"
cd "C:\Program Files\Mozilla Firefox\"
start firefox.exe
cd "C:\Program Files\Sublime Text 3\"
start sublime_text.exe
exit