Use the WINSHELL to close the registry

Time:2020-8-14

Recently, there is a problem with the laptop. The computer sleep only has a black screen and cannot enter the standby (S3) state. After searching powercfg and finding no reason, it suddenly occurred to me that it might beLeave modeIt’s making trouble. As a win10 user who loves the command line, you don’t need regedit.

After consulting the information about opening PowerShell, I found that the way that shell modifies the registry is similar to operating the file directory, and the entries in the directory are the attributes of the directory.

The first step to start modifying the registry is to enter the virtual drive, HKEY_ LOCAL_ Machine corresponds to HKLM

Set-Location HKLM:

Show HKEY_ LOCAL_ The directory in machine can also be usedGet-ChildItem (ls)

Use the WINSHELL to close the registry

To remove the leave mode, we go toHKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session ManagerThe corresponding directory isHKLM:\SYSTEM\CurrentControlSet\Control\Session Manager

Set-Location "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager"

Away from mode awaymomodeenabled is just a property of power

> Get-ItemProperty power

......
KernelResumeIoCpuTime            : 0
HiberIoCpuTime                   : 0
HybridBootAnimationTime          : 1524
ResumeCompleteTimestamp          : 105335390
AwayModeEnabled                  : 1
......

> Get-ItemProperty power | Select-Object AwayModeEnabled

AwayModeEnabled
---------------
              1

It is also easy to delete this item

Remove-ItemProperty Power -Name AwayModeEnabled

In summary,An ordercloseLeave mode

Remove-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Power" -Name AwayModeEnabled

Of course, you can add it back. The order is here

New-ItemProperty Power -Name AwayModeEnabled -Value 1