For development purposes, I want a script that just enters in a folder, executes a command there, and when it finishes or fails, waits for user's input, instead of closing the window.
Is this possible?
This is my current script, it works but when the app fails compiling, it should just throw an error to the console and prompt the user for a new command again, instead of closing as it does now:
cd myApp
ionic serve
pause 0 2 Answers
You can try to use the set /p command. There is an example:
echo The file Input.txt doesn't exist
set /p answer= Do you want to create it now (Y/N)?
if /i "%answer:~,1%" EQU "Y" start notepad.exe
if /i "%answer:~,1%" EQU "N" exit /b
echo Please type Y for Yes or N for No 1 Add pause at the end of your script. It will print a "Press any key to continue . . ." message.