bat file operation learning

Purpose: Start other bat files through a bat file, and each start its own service.

File Directory

--project
   --frontend
     --index.html
     --frontendstart.bat
   --backend
     --index.html
     --frontendstart.bat
   --一键启动.bat

backendstart.bat file content:

@ echo off
cd /d %~dp0
serve -l 8086


pause >nul

endstart.bat file content:

@ echo off
cd /d %~dp0
serve -l 8087

pause >nul

One-click start.bat file content

@ echo off
start "" cmd /c backend\backendstart.bat
start "" cmd /c frontend\frontendstart.bat

Note: start "" cmd /c ***.bat Open a new window to execute the bat file
pause >nul to keep the interface from flashing back, usually to see the specific error
cd /d %~dp0 switch back to the current directory of the bat file to execute. Avoid parent-to-child path influence.

Guess you like

Origin blog.csdn.net/kuilaurence/article/details/131004614
Recommended