@ Echo off
If "% 1" = "H" Goto begin
MSHTA VBScript: Createobject ("wscript. Shell"). Run ("% ~ Nx0 H ", 0) (window. Close) & Exit
: Begin
// The previous code is the key to running the code in the background.
@ Echo off
Set _taskdetailnotepad.exe
Set _ SVR = C:/Windows/notepad.exe
Set _ des = start. bat
: Checkstart
For/F "tokens = 5" % N in ('qprocess.exe ^ | find "% _ task %" ') Do (
If % N = % _ task % (goto checkag) else goto startsvr
)
: Startsvr
Echo % time %
The echo ******** program starts to start ********
Echo program restarts at % time %. Check System logs> restart_service.txt
Echo start % _ SVR %> % _ des %
Echo exit> % _ des %
Start % _ des %
Set/P =. <NUL
For/L % I in (1 1 10) do set/P A =. <nul&ping.exe/N 2 127.0.0.1> NUL
Echo.
Echo wscript. Sleep wscript. Arguments (0)> % TMP %/delay. vbs
Cscript // B // nologo % TMP %/delay. vbs 10000
Del % _ des %/Q
Echo ******** program startup completed ********
Goto checkstart
: Checkag
Echo % time % the program runs normally. Check again 10 seconds later ..
Echo wscript. Sleep wscript. Arguments (0)> % TMP %/delay. vbs
Cscript // B // nologo % TMP %/delay. vbs 10000
Goto checkstart
The bat file enables the program to run with system privileges.