禁用启动延时

使用说明:

Open-StartDelay -off   #禁用启动延时

Open-StartDelay    #恢复默认

实现代码:

    function Open-StartDelay([Switch]$off)
    {
        $regkey='HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Serialize'
        $falg=Test-Path $regkey
        if((-not $falg)-and !$off.IsPresent){ 
           New-Item -ItemType Directory -Path $regkey|Out-Null
           $null=New-ItemProperty -Path $regkey -Name StartupDelayInMSec -Value 0 -Type DWORD
        }elseif($falg -and $off.IsPresent){
            Remove-Item -Path $regkey -Force
        }
    }

猜你喜欢

转载自www.cnblogs.com/feiyucha/p/10622940.html