问题:Win L锁屏失效
这个问题困扰我好久了,之前只知道锁屏相关的一个注册表键值,无意间发现还有另一个,豁然开朗
原因:允许锁屏的注册表被禁用了,涉及2个键值(我实测的时候是不需要重启和注销的,执行完就生效了)
代码语言:txt复制reg add "HKLMSOFTWAREMicrosoftWindows NTCurrentVersionAuthenticationLogonUISessionData" /v AllowLockScreen /d 1 /t REG_DWORD /f
reg add "HKLMSOFTWAREMicrosoftWindows NTCurrentVersionWinlogon" /v DisableLockWorkstation /d 0 /t REG_DWORD /f
reg add "HKCUSoftwareMicrosoftWindowsCurrentVersionPoliciesSystem" /v DisableLockWorkstation /d 0 /t REG_DWORD /f
这是我本机的情况:应用方案前后我都用reg query 查询了
代码语言:txt复制reg query "HKLMSOFTWAREMicrosoftWindows NTCurrentVersionAuthenticationLogonUISessionData" /v AllowLockScreen
reg query "HKLMSOFTWAREMicrosoftWindows NTCurrentVersionWinlogon" /v DisableLockWorkstation
reg query "HKCUSoftwareMicrosoftWindowsCurrentVersionPoliciesSystem" /v DisableLockWorkstation
reg add "HKLMSOFTWAREMicrosoftWindows NTCurrentVersionAuthenticationLogonUISessionData" /v AllowLockScreen /d 1 /t REG_DWORD /f
reg add "HKLMSOFTWAREMicrosoftWindows NTCurrentVersionWinlogon" /v DisableLockWorkstation /d 0 /t REG_DWORD /f
reg add "HKCUSoftwareMicrosoftWindowsCurrentVersionPoliciesSystem" /v DisableLockWorkstation /d 0 /t REG_DWORD /f
reg query "HKLMSOFTWAREMicrosoftWindows NTCurrentVersionAuthenticationLogonUISessionData" /v AllowLockScreen
reg query "HKLMSOFTWAREMicrosoftWindows NTCurrentVersionWinlogon" /v DisableLockWorkstation
reg query "HKCUSoftwareMicrosoftWindowsCurrentVersionPoliciesSystem" /v DisableLockWorkstation
有些情况下,我们就是需要禁止锁屏,比如云服务器自动登录的情况,就需要反其道行之:
代码语言:javascript复制reg add "HKLMSOFTWAREMicrosoftWindows NTCurrentVersionAuthenticationLogonUISessionData" /v AllowLockScreen /d 0 /t REG_DWORD /f
reg add "HKLMSOFTWAREMicrosoftWindows NTCurrentVersionWinlogon" /v DisableLockWorkstation /d 1 /t REG_DWORD /f
reg add "HKCUSoftwareMicrosoftWindowsCurrentVersionPoliciesSystem" /v DisableLockWorkstation /d 1 /t REG_DWORD /f