我正在尝试让这段代码运行。我希望这个批处理文件禁用当前用户的关机按钮。这将如何工作?比如,我应该在 SID:D 部分中替换什么?这是我目前拥有的脚本:
主要代码:icacls %windir%\system32\shutdown.exe /deny %SI%:D
剧本
:setup
timeout /t 3 /nobreak >null
rename %windir%\System32\shutdown.exe shutdown1stop.exe >null
echo.
wmic useraccount where name='%username%' get SID
echo.
echo COPY THE CODE ABOVE DOWN...
echo.
echo Press any key to continue.
pause >null
goto ctnustp
:ctnustp
cls
echo Configuring Settings...
timeout /t 3 /nobreak >null
echo Enter the code you copied down earlier:
set /p SI=
icacls %windir%\system32\shutdown.exe /deny %SI%:D
echo Configuration Successful.
echo Press any key to continue.
pause >null
答案1
NTRIGHTS –r SeShutdownPrivilege –u "<User or Group>"
如何禁用/删除 Windows 7 / Vista / XP 中的关机功能命令:
reg add "HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v NoClose /t REG_DWORD /d 1 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v NoClose /t REG_DWORD /d 1 /f
reg add HKCU\Software\Policies\Microsoft\Windows\System /v DisableCMD /t REG_DWORD /d 1 /f
但,这是坏事,看看tsshutdn