windows 任务计划程序
该程序的作用是根据触发条件(时间,时间间隔,开机操作,联网操作等),执行一些计划中的任务。
有些任务执行了,占用cpu,内存,硬盘过高,不想执行该任务,可以将该任务禁用,这时 如果找不到该任务,可以进行任务的搜索,下面写出搜索任务的办法
1.使用管理员权限打开power shell
2.如果不知道计划任务名称,知道计划任务要执行的exe程序名称,可以根据程序名称来搜索计划任务名称
在power shell中输入该命令
$tasks = Get-ScheduledTask
foreach ($task in $tasks) {
$taskAction = $task.Actions | Where-Object { $_.Execute -match "AppHostRegistrationVerifier.exe" }
if ($taskAction) {
Write-Output "Task found: $($task.TaskName)"
}
}
AppHostRegistrationVerifier.exe替换为想要搜索的程序名称
3.shell中输入搜索命令
schtasks /query /fo LIST /v | findstr 要搜索的文本
4.展示搜索效果
增加新的使用已知的 程序名称 查询 计划任务 的 windows power shell脚本(脚本后缀名为 .ps1),也可以粘贴到power shell 执行
自行修改变量$program 的值,也就是程序的名称
$program = "AppHostRegistrationVerifier.exe"
if($program -is [string] -and -not $program -eq ''){
$tasks = Get-ScheduledTask
Write-Output "开始查找该程序的任务:"
foreach ($task in $tasks) {
$taskAction = $task.Actions | Where-Object { $_.Execute -match $program }
if ($taskAction) {
Write-Output $task
}
}
Write-Output ""
Write-Output "查找结束"
} else {
Write-Output "program变量非字符串或字符串为空"
}
pause
–效果展示
可以直接看到计划任务的位置,名称,任务状态,通过Windows自带的任务计划程序将无需开启的任务状态关闭就优化成功了
下图是查找 “AppHostRegistrationVerifier.exe” 程序的计划任务