batch file - Quit command prompt after exiting Electron app -
is there way close command prompt after command line program ends?
i have electron app starting batch file following commands:
start npm start
after exiting electron app, command prompt remains open. i've tried adding exit
end of batch file, not work.
i recommend implementing goto
placeholders in batch file script can follow defined path or workflow.
similar answer here... batch - if, elseif, else
if need run command initiated batch file can use /c
flag close new window once command completed.
see answer here... bat file: open new cmd window , enter code in there
also...here's example had lying around allows user input if require multiple tasks within batch script. included 2 examples /k
flag allows windows remain open, , /c
flag closes initial command prompt.
@echo off :start cls @echo select action: @echo. @echo 1= task 1 (new cmd /c, start npm -l) @echo 2= task 2 (new cmd /k, start npm -l) @echo. set /p userinp=enter choice: set userinp=%userinp:~0,1% if "%userinp%"=="1" goto 1 if "%userinp%"=="2" goto 2 if "%userinp%"=="3" goto 3 if "%userinp%"=="4" goto 4 if not "%userinp%" =="" @echo invalid choice pause goto start :1 start cmd /c start npm -l @echo task 2 complete... @echo. @echo closing in 10 seconds... timeout /t 10 goto end :2 start cmd /k start npm -l @echo task 2 complete... @echo. @echo closing in 10 seconds... timeout /t 10 goto end :end exit
Comments
Post a Comment