Board logo

标题: [系统相关] 求助批处理schtasks 批量删除 关键词任务 [打印本页]

作者: qq8899399    时间: 2024-8-19 14:34     标题: 求助批处理schtasks 批量删除 关键词任务

G:\Downtemp\edge>schtasks /query /fo csv |findstr /I MicrosoftEdge
"\MicrosoftEdgeUpdateBrowserReplacementTask","N/A","就绪"
"\MicrosoftEdgeUpdateTaskMachineCore{6FB29BF6-EB3C-4326-AD82-701E4AA30538}","2024/8/19 14:43:42","就绪"
"\MicrosoftEdgeUpdateTaskMachineCore{6FB29BF6-EB3C-4326-AD82-701E4AA30538}","2024/8/19 14:43:42","就绪"
"\MicrosoftEdgeUpdateTaskMachineUA{35251314-FA8F-43D9-AA53-1F684058C880}","2024/8/19 15:13:42","就绪"

因为SID不一样。所以。 请问。批处理如何写  能先从schtasks /query结果 里找到MicrosoftEdgeUpdate里相关的任务删除
作者: qq8899399    时间: 2024-8-19 14:42

PS的话。是
Get-ScheduledTask -taskname MicrosoftEdgeUpdate* | Unregister-ScheduledTask -Confirmfalse

但想用批处理实现这一功能
作者: ygqiang    时间: 2024-8-19 16:00

  1. @echo off & setlocal enabledelayedexpansion
  2. echo 代码开始
  3. @echo off &for /f "tokens=1* delims=: " %%a in (
  4. ' schtasks /query /fo list^|findstr /irc:".*Windows Defender*.*" ') do (echo,schtasks /delete /tn "%%b" /f)
  5. @echo off &for /f "tokens=1* delims=: " %%a in (
  6. ' schtasks /query /fo list^|findstr /irc:".*MicrosoftEdge*.*" ') do (echo,schtasks /delete /tn "%%b" /f)
  7. @echo off &for /f "tokens=1* delims=: " %%a in (
  8. ' schtasks /query /fo list^|findstr /irc:".*Wps*.*" ') do (echo,schtasks /delete /tn "%%b" /f)
  9. pause
  10. @echo off &for /f "tokens=1* delims=: " %%a in (
  11. ' schtasks /query /fo list^|findstr /irc:".*Windows Defender*.*" ') do (schtasks /delete /tn "%%b" /f)
  12. @echo off &for /f "tokens=1* delims=: " %%a in (
  13. ' schtasks /query /fo list^|findstr /irc:".*MicrosoftEdge*.*" ') do (schtasks /delete /tn "%%b" /f)
  14. @echo off &for /f "tokens=1* delims=: " %%a in (
  15. ' schtasks /query /fo list^|findstr /irc:".*Wps*.*" ') do (schtasks /delete /tn "%%b" /f)
  16. pause
复制代码

作者: qq8899399    时间: 2024-8-19 16:28

回复 3# ygqiang


    感谢~




欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2