windows 任务计划程序 搜索任务位置的方法

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” 程序的计划任务
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值