无忧启动论坛

标题: 【已解决】求修改wcs代码:检测到2个以上notepad.exe进程,就结束notepad.exe进程... [打印本页]

作者: yyz2191958    时间: 2024-3-31 20:32
标题: 【已解决】求修改wcs代码:检测到2个以上notepad.exe进程,就结束notepad.exe进程...
本帖最后由 yyz2191958 于 2024-4-2 12:52 编辑

完美解决了:

一、检测到2个以上进程,就结束它.wcs
//每秒检测1次notepad2.exe进程,进程 > = 2个,就结束notepad2.exe进程,并退出循环(进退出pecmd.exe)
//===========================================================================================
LOOP #1=1,
{* find --pid*@. &V,notepad2.exe
    Read -*,-1,&V,&V
    ifex $%&V%<2,!Team kill notepad2.exe|exit loop|exit file
    WAIT 1000 }
//===========================================================================================

二、0进程退出--2个以上进程,就结束它.wcs:
//pecmd wait 100 //延时100毫秒   //→注释;exec→运行; exec =!000.bate→隐藏窗口
//exec =!000.bat 【(exec后面有 = 号,等待退出)(exec后面无 = 号,不等待)】
//===============================================================================================
//每秒检测1次notepad2.exe进程,0进程退出--2个以上进程,就结束进程并退出
//===============================================================================================
LOOP #1=1,
{* find --pid*@. &V,notepad2.exe
    Read -*,-1,&V,&V
    ifex $%&V%>0,!Team kill notepad2.exe|exit loop|exit file  //0进程,结束进程并退出
    ifex $%&V%<2,!Team kill notepad2.exe|exit loop|exit file  //2进程,结束进程并退出
    WAIT 1000 }
//===============================================================================================
感谢:conlin888


*******************************************************************************
原来的问题
已有代码:

//每秒检测一次notepad.exe进程,发现notepad.exe进程大于或等于2个就弹窗显示:找到了2个以上...
LOOP #1=1,
{*  Team find --pid*@. &V,notepad.exe|Read -*,-1,&V,&V|ifex $%&V%<2,!mess. 找到了2个以上...
    WAIT 1000
}
==================================================================================
现在的需求是:
//每秒检测一次notepad.exe进程,发现notepad.exe进程大于或等于2个,就结束notepad.exe进程,并退出循环(即退出pecmd.exe)
(PE 下使用)
谢谢










作者: zlq_hysy    时间: 2024-3-31 20:52
我是小白,帮顶
作者: conlin888    时间: 2024-3-31 21:03

LOOP #1=1,
{* find --pid*@. &V,notepad.exe
    Read -*,-1,&V,&V
    ifex $%&V%<2,!Team kill notepad.exe|exit loop|exit file
    WAIT 1000
}

作者: yyz2191958    时间: 2024-3-31 21:03
zlq_hysy 发表于 2024-3-31 20:52
我是小白,帮顶

谢谢
作者: yyz2191958    时间: 2024-3-31 21:04
conlin888 发表于 2024-3-31 21:03
LOOP #1=1,
{* find --pid*@. &V,notepad.exe
    Read -*,-1,&V,&V

我试一试先 谢谢
作者: yyz2191958    时间: 2024-3-31 21:07
conlin888 发表于 2024-3-31 21:03
LOOP #1=1,
{* find --pid*@. &V,notepad.exe
    Read -*,-1,&V,&V

成功了 再次感谢
作者: yyz2191958    时间: 2024-3-31 21:18
完美解决了:
//每1检测1次notepad2.exe进程,进程 > = 2个,就结束notepad2.exe进程,并退出循环(进退出pecmd.exe)
//===========================================================================================
LOOP #1=1,
{* find --pid*@. &V,notepad2.exe
    Read -*,-1,&V,&V
    ifex $%&V%<2,!Team kill notepad2.exe|exit loop|exit file
    WAIT 1000 }
//===========================================================================================
感谢:conlin888
作者: zlq_hysy    时间: 2024-3-31 21:19
真为你高兴
作者: 2012飘水    时间: 2024-4-3 15:11
长姿势了,感谢




欢迎光临 无忧启动论坛 (http://wuyou.net./) Powered by Discuz! X3.3