- @echo off
- net session >nul 2>&1
- if errorlevel 1 (
- mshta vbscript:CreateObject("Shell.Application"^).ShellExecute("%~s0","","","runas",1^)(window.close^)
- exit /b
- )
- %1 %2
- cd /d "%~dp0"
- REM 锁定内存页
- cmd /u /c ""%~f0" goto settings"
- secedit /configure /db "%~dp0LockPages.sdb" /cfg "%~dp0LockPages.inf" /log "%~dp0LockPages.log" /overwrite /quiet
-
- REM 重启后自动打开指定软件
- set myapp="c:\windows\system32\notepad.exe"
- reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /v "MyApp" /t REG_SZ /d %myapp% /f
-
- REM 重启电脑
- shutdown /r /t 0
-
- exit /b
-
- :settings
- for /f "tokens=2 delims=," %%A in ('whoami /user /fo csv /nh') do set sid=*%%~A
- >".\LockPages.inf" (
- echo [Unicode]
- echo Unicode=yes
- echo [Version]
- echo signature="$CHICAGO$"
- echo Revision=1
- echo [Privilege Rights]
- echo SeLockMemoryPrivilege = %sid%
- )
复制代码
|