标题: [文件操作] 批处理怎样实现只让指定的程序运行? [打印本页]
作者: qiu 时间: 2010-10-6 13:01 标题: 批处理怎样实现只让指定的程序运行?
请问一下谁能用这个做一个只让指定的程序运行
以下是COPY来的不知道好用不
set /p ip=请输入IP地址最后位格式1-254:
set /p user=请输入用户名:
set /p password=请输入密码:
for /f "tokens=3 delims= " %%i in ('tasklist /s 192.168.1.%ip% /u %user% /p "%password%" /fo list^|find "图像名"') do (type %0|find /i "%%i"||taskkill /s 192.168.1.%ip% /u %user% /p "%password%" /fi "IMAGENAME eq %%i"&pause)
exit
csrss.exe
Dfssvc.exe
llssrv.exe
lsass.exe
msdtc.exe
Ravmon.exe
Ravmond.exe
RavStub.exe
RavTask.exe
services.exe
smss.exe
spoolsv.exe
sqlmangr.exe
sqlservr.exe
svchost.exe
System
System Idle Process
winlogon.exe
WinMgmt.exe
Explorer.exe
以上用于精简远程机器进程
:a
for /f "tokens=3 delims= " %%i in ('tasklist /fo list^|find "图像名"') do (type %0|find /i "%%i"||taskkill /fi "IMAGENAME eq %%i"&pause)
goto :a
exit
csrss.exe
Dfssvc.exe
llssrv.exe
lsass.exe
msdtc.exe
Ravmon.exe
Ravmond.exe
RavStub.exe
RavTask.exe
services.exe
smss.exe
spoolsv.exe
sqlmangr.exe
sqlservr.exe
svchost.exe
System
System Idle Process
winlogon.exe
WinMgmt.exe
Explorer.exe
作者: qiu 时间: 2010-10-6 13:37
@echo off
for /f "tokens=1 delims= " %%i in ('tasklist /nh') do (
if not defined %%i (
type list.txt|findstr /i "%%i">nul 2>nul || taskkill /f /im "%%i"&set "%%i=a"
))
echo 完成.
pause
这个谁能帮忙试一下能用不。如果能用怎么样让他从复运行并隐藏运行窗口
作者: qiu 时间: 2010-10-6 14:16
COPY来的东西谁能帮我修正一下。这个不结束多余的进程,先谢谢了
@echo off
cd /d C:\
echo wmiprvse.exe >kill.txt
echo smss.exe >>kill.txt
echo csrss.exe >>kill.txt
echo services.exe >>kill.txt
echo lsass.exe >>kill.txt
echo winlogon.exe >>kill.txt
echo svchost.exe >>kill.txt
echo explorer.exe >>kill.txt
echo sidebar.exe >>kill.txt
echo RocketDock.exe >>kill.txt
echo QQ.exe >>kill.txt
echo TXPlatform.exe >>kill.txt
echo svchost.exe >>kill.txt
echo ctfmon.exe >>kill.txt
:::::::::浏览器echo iexplore.exe >>kill.txt
echo cmd.exe >>kill.txt
echo tasklist.exe >>kill.txt
echo QQ.exe >>kill.txt
echo qq.exe >>kill.txt
echo play.exe >>kill.txt
::::::::要长期保留的进程请加在这行上面,如echo xxoo.exe >>kill.txt这样的形式
echo %1 >>kill.txt
echo %2 >>kill.txt
echo %3 >>kill.txt
echo %4 >>kill.txt
echo %5 >>kill.txt
echo %6 >>kill.txt
echo %7 >>kill.txt
echo %8 >>kill.txt
echo %9 >>kill.txt
echo 程序工作中........................
echo :::bat by 江南一根葱 :::
echo 正在杀死进程,请稍候…………
for /f "skip=5" %%i in ('tasklist') do call :kill %%i
pause >nul
:kill
find "%1" C:\kill.txt >nul
if not "%errorlevel%"=="0" taskkill /f /im %~n1.exe
作者: qiu 时间: 2010-10-6 15:35 标题: 如何结束系统多于进程
请间,我如何能做到除文本以内标注的进程,别的进程自动结束。
作者: cjiabing 时间: 2010-10-6 15:37
意思是只让系统进程和指定进程运行?
你发的什么东东一个看不懂
作者: cjiabing 时间: 2010-10-6 15:48
- @echo off
- title %~n0
- for /f "skip=3 tokens=2" %%a in ('TASKLIST /FI "WINDOWTITLE eq %~n0" /FI "STATUS eq running"') do set pcmd=%%a
- set /p "vard=允许运行进程【如:QQ.exe IEXPLORE.EXE】:"
- :a
- cd.>%temp%_npslist.txt
- for /f "skip=3 tokens=1,2" %%a in ('tasklist') do echo %%a %%b|findstr /i /v "System smss.exe csrss.exe winlogon.exe services.exe lsass.exe svchost.exe conime.exe explorer.exe wmiprvse.exe Userinit.exe taskkill.exe spoolsv.exe ctfmon.exe alg.exe tasklist.exe %vard%">>%temp%_npslist.txt
- for /f "tokens=1,2" %%a in (%temp%_npslist.txt) do (
- set ovar=%%a&&if not defined ovar goto b
- if /i "%%a"=="cmd.exe" (if not %%b==%pcmd% taskkill /f /t /pid %%b) else (taskkill /f /t /im %%a||NTSD -c q -P %%a)
- )
- :b
- del %temp%_npslist.txt>nul 2>nul
- ping /n 5 127.0.1>nul
- goto a
-
复制代码
[ 本帖最后由 cjiabing 于 2010-10-6 17:14 编辑 ]
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |