I have created a simple batch script to pseudo-lock a computer using the following code:
@ECHO OFF & setlocal ENABLEDELAYEDEXPANSION
setlocal EnableDelayedExpansion
color a
TITLE Lock
if not "%1" == "max" (
powershell -command "& { $x = New-Object -ComObject Shell.Application; $x.minimizeall() }"
start /MAX cmd /c %0 max & exit/b
)
:Lock
echo Please enter a password to lock your computer . . .
powershell -Command $pword = read-host "Enter password" -AsSecureString ; $BSTR=[System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($pword) ; [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR) > EOFlock.txt & set /p Pass1=<EOFlock.txt & del EOFlock.txt
TITLE Lock
taskkill /IM explorer.exe /F >nul
cls
echo Please type the password to unlock the computer . . .
:Locked
set /p Pass2=
:Unlock
if !Pass1! == !Pass2! (goto End)
goto Locked
:End
start explorer.exe
echo This Computer is unlocked.
I want this window to stay on top, and preferably be unclosable until it has reached the end of the file. However, I did not find a way to do this yet.