1
DemianL 2023-04-07 22:14:11 +08:00 via Android
emmm 系统设置里面有个合上盖子的选项 你可以选择什么都不做它就不休眠了...
|
2
FlyPuff 2023-04-07 22:24:13 +08:00 via Android
新电脑么?现在的新电脑都是只支持合盖现代(关屏幕)休眠了吧。。
|
4
ysc3839 2023-04-08 01:04:48 +08:00 via Android
推荐一下自己开发的项目 https://github.com/ysc3839/ProjectionAwake
|
5
ISVStar 2023-04-08 04:00:50 +08:00 1
我写了一个这样的 PowerShell 脚本,不完全符合你的要求。运行脚本后,忽略下一次合盖睡眠。
# grab powercfg guids necessary for lid switch action # https://docs.microsoft.com/en-us/windows-hardware/customize/power-settings/power-button-and-lid-settings-lid-switch-close-action #capture the active scheme GUID $activeScheme = cmd /c "powercfg /getactivescheme" $regEx = '(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}' $asGuid = [regex]::Match($activeScheme,$regEx).Value #relative GUIDs for Lid Close settings $pwrGuid = '4f971e89-eebd-4455-a8de-9e59040e7347' $lidClosedGuid = '5ca83367-6e45-459f-a27b-476b1d01c936' # DC Value // On Battery // 0 = do nothing cmd /c "powercfg /setdcvalueindex $asGuid $pwrGuid $lidClosedGuid 0" # AC Value // While plugged in // 0 = do nothing cmd /c "powercfg /setacvalueindex $asGuid $pwrGuid $lidClosedGuid 0" #apply settings cmd /c "powercfg /s $asGuid" echo "You can now close the lid ..." $ScreenCount = (Get-CimInstance -Namespace root\wmi -ClassName wmiMonitorID | Measure-Object).Count Do { $ScreenCountRecur = (Get-CimInstance -Namespace root\wmi -ClassName wmiMonitorID | Measure-Object).Count Start-Sleep -Seconds 1 } While($ScreenCountRecur -ge $ScreenCount) # DC Value // On Battery // 1 = sleep cmd /c "powercfg /setdcvalueindex $asGuid $pwrGuid $lidClosedGuid 1" # AC Value // While plugged in // 1 = sleep cmd /c "powercfg /setacvalueindex $asGuid $pwrGuid $lidClosedGuid 1" |
6
ISVStar 2023-04-08 04:02:19 +08:00 1
#capture the active scheme GUID
$activeScheme = cmd /c "powercfg /getactivescheme" $regEx = '(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}' $asGuid = [regex]::Match($activeScheme,$regEx).Value #relative GUIDs for Lid Close settings $pwrGuid = '4f971e89-eebd-4455-a8de-9e59040e7347' $lidClosedGuid = '5ca83367-6e45-459f-a27b-476b1d01c936' # DC Value // On Battery // 0 = do nothing cmd /c "powercfg /setdcvalueindex $asGuid $pwrGuid $lidClosedGuid 0" # AC Value // While plugged in // 0 = do nothing cmd /c "powercfg /setacvalueindex $asGuid $pwrGuid $lidClosedGuid 0" #apply settings cmd /c "powercfg /s $asGuid" echo "You can now close the lid ..." $ScreenCount = (Get-CimInstance -Namespace root\wmi -ClassName wmiMonitorID | Measure-Object).Count Do { $ScreenCountRecur = (Get-CimInstance -Namespace root\wmi -ClassName wmiMonitorID | Measure-Object).Count Start-Sleep -Seconds 1 } While($ScreenCountRecur -ge $ScreenCount) # DC Value // On Battery // 1 = sleep cmd /c "powercfg /setdcvalueindex $asGuid $pwrGuid $lidClosedGuid 1" # AC Value // While plugged in // 1 = sleep cmd /c "powercfg /setacvalueindex $asGuid $pwrGuid $lidClosedGuid 1" |
8
yinmin 2023-04-08 17:23:26 +08:00
换一个思路:笔记本插上电源时,合上电脑不休眠;如果用上电池,合上电脑才休眠。这种场景是不是可以满足你大多数的场景?
根据插电源来判断,在 windows 设置里可以配置。 |