使用说明:
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 } }