|
本帖最后由 9zhmke 于 2019-11-1 00:14 编辑
流氓软件的计划任务太可恶了,写个小脚本来搞掉它,把以下内容存到一个文本文件,扩展名改为.vbs即可。如果不能运行,那可能是编码用错,切换回ANSI编码重新粘贴保存即可,不想麻烦的可以直接下载附件。
20191101更新:在空列表时会出现12行left语句出错,已修正
懒人使用:
删除任务.7z
(721 Bytes, 下载次数: 261)
1、基本上所有的流氓行为都在最外面一层,没有发现过藏到子目录里,所以只删除最外面一层的计划任务
2、整体删除所有计划任务会影响到系统运行,特别是显示不了输入法,所以不能简化成schtasks /delete /TN * /F
- '删除流氓软件产生的计划任务
- Set WshShell=WScript.CreateObject("WScript.Shell")
- Set tmp1 = WshShell.Exec("SCHTASKS /Query /FO:csv") '取出现有计划列表
- tmp2 = tmp1.StdOut.ReadAll()
- if len(tmp2)<20 then
- Set tmp1 = WshShell.Exec("cmd /c chcp 437&%COMSPEC% /C ""SCHTASKS /Query /FO:csv""") '提高兼容性重新取出
- tmp2 = tmp1.StdOut.ReadAll()
- end if
- if instr(tmp2,"437")>0 then tmp2=right(tmp2,len(tmp2)-instr(tmp2,chr(13))-1)'和下面句一起实现去除首行目录
- if instr(tmp2,"任务名")>0 or instr(tmp2,"TaskName")>0 then tmp2=right(tmp2,len(tmp2)-instr(tmp2,chr(13))-1)
- tmp1=instr(tmp2,"TaskName"):if tmp1<1 then tmp1=instr(tmp2,"任务名")
- if instr(tmp2,"不存在任何可用的计划任务")<1 and tmp1>12 then'如果不是空的
- tmp2=left(tmp2,tmp1-8) '去除后面微软自己的
- tmp1 = Split(tmp2,chr(13) )'分解出每一行
- for i=0 to UBound(tmp1)'遍历数组
- tmp2=Split(tmp1(i),",")'分离后方的日期
- if tmp1(i)>"" then'如果不是空的
- if left(tmp2(0),1)<" " then tmp2(0)=right(tmp2(0),len(tmp2(0))-1)
- WshShell.Run "schtasks /delete /TN " & tmp2(0) & " /F",0,true
- end if
- Next
- end if
复制代码
|
评分
-
查看全部评分
|