Although I dont know how to stop the spawning of the explorer process with the behavior outlined above, but here is a the kill wa
Main script:
@echo off
powershell -command "& { $x = New-Object -ComObject Shell.Application; $x.minimizeall() }"
start /min kill_switch.bat
:a
start /w Lock.bat
goto a
Lock.bat:
@echo off
mode 35,10
cls
color a
title Locked by %username%
echo What is the password?
set /p password=
if %password%==password goto end
goto fail
:end
echo "start explorer">"%TEMP%\startex.trace"
exit
:fail
exit
kill_switch.bat:
@echo off
if exist "%TEMP%\startex.trace" del /q "%TEMP%\startex.trace"
:KILL_SWITCH
for /f "skip=2 tokens=2 delims= " %%a in ('tasklist /FI "IMAGENAME eq explorer.exe"') do (
echo INFO: Killing PID %%a
taskkill /PID %%a /F
)
timeout /t 5 >nul
if not exist "%TEMP%\startex.trace" (
goto KILL_SWITCH
) else (
del /q "%TEMP%\startex.trace"
)