如何定位Windows开机自动触发的PowerShell脚本文件位置?
排查启动项的关键位置:
用户/公共开机启动文件夹
按下Win + R,输入shell:startup回车,打开当前用户的开机启动目录,查找是否有指向C:\Users\andre\Downloads\Programs\NumLockOn.ps1的快捷方式或批处理文件,找到后直接删除即可。
还可以输入shell:common startup检查公共启动文件夹,按同样方式处理。任务计划程序
按下Win + S搜索「任务计划程序」并打开,左侧导航栏展开「任务计划库」,逐个检查任务,找到执行命令包含目标脚本路径的任务,右键选择禁用或删除。注册表启动项
按下Win + R输入regedit打开注册表编辑器,导航到以下路径,查找值数据包含目标脚本路径的条目,右键删除:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunHKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunHKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Run
PowerShell配置文件
打开PowerShell,输入Get-Content $PROFILE查看当前用户的配置文件,若存在调用该脚本的命令,删除对应行并保存。不知道配置文件路径的话,输入$PROFILE即可查看,若文件不存在则无需处理。
报错信息:
& : The term 'C:\Users\andre\Downloads\Programs\NumLockOn.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:2
- &'C:\Users\andre\Downloads\Programs\NumLockOn.ps1'
- CategoryInfo : ObjectNotFound: (C:\Users\andre...s\NumLockOn.ps1:String) [],
CommandNotFoundException- FullyQualifiedErrorId : CommandNotFoundException
内容的提问来源于stack exchange,提问作者ALKochListon

