中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

中国DOS联盟论坛
现在时间是 2026-08-12 17:40
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » 求助:帮我看下这个检测进程的脚本 谢谢 查看 1,112 回复 0
楼 主 求助:帮我看下这个检测进程的脚本 谢谢 发表于 2009-12-02 01:09 ·  中国 广东 东莞 电信
新手上路
积分 3
发帖 2
注册 2007-12-27 05:00
18年会员
UID 106897
性别 男
状态 离线
如果进程TInstall.exe存在则执行D:\Soft\desktopli\1130\off.bat,如果进程不存在则执行D:\Soft\desktopli\1130\li.vbs,并且没有检测到Tinstall.exe就一直检测!
option Explicit
dim wmi,proc,procs,proname,flag,WshShell
Do
proname="TInstall.exe"
set wmi=getobject("winmgmts:{impersonationlevel=impersonate}!\\.\root\cimv2")
set procs=wmi.execquery("select * from win32_process")
flag=true
for each proc in procs
if strcomp(proc.name,proname)=0 then
flag=false
exit for
end if
next
set wmi=nothing
if not flag then
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "D:\Soft\desktopli\1130\off.bat",0,True
Set Wsh=NoThing
WScript.quit
end if
wscript.sleep 1000
loop



另外一个问题:随机读取ID.txt(ID.txt里全是进程名)里的一行将A.exe改名为读取到的进程名,然后执行现在这个程序!
randomize
set fso=createobject("scripting.filesystemobject")
set a=createobject("scripting.dictionary")
set file=fso.opentextfile("iD.txt")
do while file.atendofstream<>true
m=m+1
a.add m,file.readline
loop
file.close
h=int(rnd*m)
createobject("scripting.filesystemobject").opentextfile("li.txt",2,-1).write a(h)
Dim Wsh
Set Wsh = WScript.CreateObject("WScript.Shell")
WScript.Sleep(0000)
Wsh.Run "on.bat",0,True
Set Wsh=NoThing
WScript.quit

[ Last edited by dglichong on 2009-12-2 at 01:12 ]
论坛跳转: