BATCH - how to on close restart? or protect closing?

387 views Asked by At

Kiosk in public where mouse and touch screen's are enabled.

On boot/login the script is executed but before going to step 4 many user click the close icon and shutdown the command prompt.

Which cause the process into fail.

How to make sure the startup process did not got interupted? how to block shutdown of command prompt before the step 4?

::================ Danger Start ===============
@echo on
:start

echo "1. Please dont click that close icon and close me. I beg..."
timeout 5 > nul
echo "2. Please dont click that close icon and close me. I beg..."
tskill chrome 2>NUL
echo "3. Please dont click that close icon and close me. I beg..."
tskill node 2>NUL
:: some other tasks: Bank card, Ticket, Badge, hardware get re-activated

::================ Danger END ===============



echo "4. Uff.. crossed my finger and finally started"
@start /wait "Kiosk" "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" www.example.com

cls
echo "5. i will restart now."
timeout 5 >nul


goto start
1

There are 1 answers

0
Gerhard On BEST ANSWER

Unfortunately cmd does not have a noclose function. There are options of standalone tools, but that means you have to load that for each machine.

Easiest way is to hide the batch file completely.

create a VBS file examplefilename.vbs

put this in it.

Set LoginScript    = CreateObject("WScript.Shell")
LoginScript.Run "f:\login.cmd", 0, False

Just correct the path and filename of the cmd or bat file.

Then run the vbs file to call and hide the cmd completely.

So you will as of then call the vbs file instead of the batch file, the VBS in turn will call the batch.