批量去除Windows10系统中某个应用(以OneDrive为例)的开机启动项脚本以下:shell
reg query HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run | findstr "OneDrive" if ($? -eq "True"){ reg delete HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v OneDrive /f }
注:安全
启动项路径还可能在注册表的如下路径中:ide
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run" "HKCU:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run"
Windows10默认安全设置是不能执行powershell脚本,须要经过组策略开启执行powershell脚本执行或手动以管理员权限执行如下命令:rest
Set-ExecutionPolicy Unrestricted