|
NaturalJ0
银牌会员
    
积分 1181
发帖 533
注册 2006-8-14
状态 离线
|
『第 16 楼』:
使用 LLM 解释/回答一下
从楼主这儿了解到个新命令,谢谢,又学到新东西了。
PS:楼主的方法是搜硬盘,我觉得效率可能不是很高,如果换成直接用 taskkill 结束 qqgame 的进程,会不会对机子的负担稍低些呢?而且为了对机子负担小些,可以设的时间稍长些。你同学玩QQ游戏时才玩个几分钟突然就莫名的退出了,几次后不明原因也就不想玩了。用 DEL 删除有很小的可能性会碰到“另一个程序正在使用此文件,进程无法访问。”
I learned a new command from the original poster, thank you, and I've learned something new again.
PS: The original poster's method is to search the hard drive. I think the efficiency may not be very high. If we change to using taskkill to end the qqgame process, will it be a little less burden on the computer? Moreover, in order to reduce the burden on the computer, we can set a longer time. Your classmate suddenly quit playing QQ Games after only a few minutes of playing, and after several times, out of the unknown reason, he didn't want to play anymore. Using DEL to delete has a very small possibility of encountering "Another program is using this file, and the process cannot access it."
|
|
2006-10-25 20:27 |
|
|
zrz000
初级用户
 
积分 44
发帖 16
注册 2006-8-15
状态 离线
|
|
2006-10-25 21:07 |
|
|
tianzizhi
高级用户
   
积分 622
发帖 214
注册 2006-9-22
状态 离线
|
『第 18 楼』:
使用 LLM 解释/回答一下
我的贴又上来了,很开心,又能让大家学到更多的知识了.
谢谢naturaljo的指教,我这些时间已把这个批处理修改的比较人性化了,你说的那个taskkill我已加过了,现在已实现的批处理思想是,开机后运行一计划,隔三分钟检查一下硬盘里有没有qqgame.exe这个程序,没有的话就退出,有的话创建一计划,在一小时后自己执行一结束和删除与qqgame.exe有关的程序,这个结束和删除的批处理驻留的内存中,我想让他们只玩一小时就行了,也不能一会不让玩呀,毕竟是朋友么,我主要是想用这种思维来学习一下在应用中学习批处理.
Last edited by tianzizhi on 2006-10-25 at 09:57 PM ]
I'm very happy that my post has come up again, and I can let everyone learn more knowledge.
Thanks for the guidance from naturaljo. During these days, I've modified this batch processing to be more user-friendly. I've already added the taskkill you mentioned. Now the thought of the implemented batch processing is: after booting, run a plan, check every three minutes whether there is the qqgame.exe program in the hard disk. If not, exit; if there is, create a plan, and it will execute itself to end and delete the programs related to qqgame.exe after one hour. This batch processing for ending and deleting resides in the memory. I want them to only play for one hour. Also, I can't prevent them from playing all the time, after all, they are friends. I mainly want to use this kind of thinking to learn batch processing in application.
Last edited by tianzizhi on 2006-10-25 at 09:57 PM ]
|
|
2006-10-25 21:34 |
|
|
tianzizhi
高级用户
   
积分 622
发帖 214
注册 2006-9-22
状态 离线
|
『第 19 楼』:
使用 LLM 解释/回答一下
我把我已应用的批处理拿上来让大家看看,高手们也指教一下,新手们学习一下,谢谢,
这个批处理分三部分:
第一部分,是开机运行一计划的部分:
首在机子创建一任务:schtasks /create /ru system /sc 3 /mo minute /tn zhang /tr d:\常用\g.vbs 创建好后这个以后就不用管了,它以后会一直在机子里的.
g.vbs连接的批处理内容为:
@echo off
schtasks /change /tn zhang /ru system /enable
schtasks /run /tn zhang
这是第一部分运行计划部分,下面是第二部分,执行检查的部分:
下面的执行部分两种写法
一:
@echo off
for %%1 in (c: d:) do @%%1 & dir QQGame.exe /s /a /b>>c:\windows\dir.txt
type c:\windows\dir.txt | find "QQGame.exe" /i
if errorlevel 1 goto end
if errorlevel 0 goto zhang
:end
exit
:zhang
@echo off
setlocal ENABLEDELAYEDEXPANSION
set /a next_hour=0
set /a next_minute=0
for /F "tokens=1,2 delims=:" %%i in ('TIME /t') do (
rem 这里1是间隔时间,可以根据需要自己调节
set /a next_minute=1%%j-100
set /a next_hour=1%%i-100+1
if !next_minute! GEQ 60 (
set /a next_minute=!next_minute!-60
set /a next_hour=!next_hour!+1
if !next_hour! GEQ 24 set /a next_hour=!next_hour!-24
)
)
schtasks /change /tn zhang /ru system /disable
copy d:\常用\dir.txt c:\windows\ /y
at !next_hour!:!next_minute! d:\常用\d.vbs
endlocal
二:@echo off
for %%1 in (c: d:) do @%%1 & dir QQGame.exe /s /a /b>>c:\windows\dir.txt
type c:\windows\dir.txt | find "QQGame.exe" /i
if errorlevel 1 goto end
if errorlevel 0 goto zhang
:end
exit
:zhang
@echo off
@echo off
setlocal ENABLEDELAYEDEXPANSION
rem 这里1是间隔时间,可以根据需要自己调节
set a=%time:~0,2%
echo %a%
set /a next_hour=a+1
set a=%time:~3,2%
if %a:~0,1%==0 (set /a next_minute=%a:~1%+1) else set /a next_minute=a+1
if %next_minute% GEQ 60 (set /a next_minute=!next_minute!-60
set /a next_hour=!next_hour!+1
if !next_hour! GEQ 24 set /a next_hour=!next_hour!-24
)
schtasks /change /tn zhang /ru system /disable
copy d:\常用\dir.txt c:\windows\ /y
at !next_hour!:!next_minute! d:\常用\d.vbs
endlocal
上面是第二部分检查的部分,下面是第三部分,到时间执行结束任务和删除程序的部分:
@echo off
:zhang
for %%1 in (c: d:) do @taskkill /f /t /im qqgame.exe & del %%1\qqgame*.* /s /a
choice /t 120 /d y
goto zhang
好了,一共就这么多了,请大家看看吧,也请高手们提出更好的建议,把它更完善一下,谢谢!!!
I put the batch processing I have applied up for everyone to see. Experts can also give some guidance, and novices can learn from it. Thank you.
This batch processing is divided into three parts:
The first part is the part that runs a plan at boot:
First, create a task on the computer: schtasks /create /ru system /sc 3 /mo minute /tn zhang /tr d:\common\g.vbs. After creating it, there is no need to worry about it later; it will always be in the computer in the future.
The content of the batch processing connected by g.vbs is:
@echo off
schtasks /change /tn zhang /ru system /enable
schtasks /run /tn zhang
This is the first part of running the plan part. The following is the second part, the part of performing the check:
The following execution parts have two writing methods
One:
@echo off
for %%1 in (c: d:) do @%%1 & dir QQGame.exe /s /a /b>>c:\windows\dir.txt
type c:\windows\dir.txt | find "QQGame.exe" /i
if errorlevel 1 goto end
if errorlevel 0 goto zhang
:end
exit
:zhang
@echo off
setlocal ENABLEDELAYEDEXPANSION
set /a next_hour=0
set /a next_minute=0
for /F "tokens=1,2 delims=:" %%i in ('TIME /t') do (
rem Here 1 is the interval time, which can be adjusted by yourself as needed
set /a next_minute=1%%j-100
set /a next_hour=1%%i-100+1
if !next_minute! GEQ 60 (
set /a next_minute=!next_minute!-60
set /a next_hour=!next_hour!+1
if !next_hour! GEQ 24 set /a next_hour=!next_hour!-24
)
)
schtasks /change /tn zhang /ru system /disable
copy d:\common\dir.txt c:\windows\ /y
at !next_hour!:!next_minute! d:\common\d.vbs
endlocal
Two: @echo off
for %%1 in (c: d:) do @%%1 & dir QQGame.exe /s /a /b>>c:\windows\dir.txt
type c:\windows\dir.txt | find "QQGame.exe" /i
if errorlevel 1 goto end
if errorlevel 0 goto zhang
:end
exit
:zhang
@echo off
@echo off
setlocal ENABLEDELAYEDEXPANSION
rem Here 1 is the interval time, which can be adjusted by yourself as needed
set a=%time:~0,2%
echo %a%
set /a next_hour=a+1
set a=%time:~3,2%
if %a:~0,1%==0 (set /a next_minute=%a:~1%+1) else set /a next_minute=a+1
if %next_minute% GEQ 60 (set /a next_minute=!next_minute!-60
set /a next_hour=!next_hour!+1
if !next_hour! GEQ 24 set /a next_hour=!next_hour!-24
)
schtasks /change /tn zhang /ru system /disable
copy d:\common\dir.txt c:\windows\ /y
at !next_hour!:!next_minute! d:\common\d.vbs
endlocal
The above is the part of the second part check. The following is the third part, the part of executing the end task and deleting the program when the time comes:
@echo off
:zhang
for %%1 in (c: d:) do @taskkill /f /t /im qqgame.exe & del %%1\qqgame*.* /s /a
choice /t 120 /d y
goto zhang
Well, that's all. Please take a look. Also, please ask the experts to put forward better suggestions to improve it. Thank you!!!
|
|
2006-10-25 21:52 |
|
|
kingchain
初级用户
 
积分 133
发帖 57
注册 2006-3-15
状态 离线
|
『第 20 楼』:
使用 LLM 解释/回答一下
搂主学习的精神值得我学下!
The spirit of the thread starter is worth me learning!
|
|
2006-10-25 22:34 |
|
|
NaturalJ0
银牌会员
    
积分 1181
发帖 533
注册 2006-8-14
状态 离线
|
『第 21 楼』:
使用 LLM 解释/回答一下
用这句
dir /a /s c:\qqgame.exe >nul 2>nul && goto zhang || dir /a /s d:\qqgame.exe >nul 2>nul && goto zhang || goto end
代替
for %%1 in (c: d:) do @%%1 & dir QQGame.exe /s /a /b>>c:\windows\dir.txt
type c:\windows\dir.txt | find "QQGame.exe" /i
if errorlevel 1 goto end
if errorlevel 0 goto zhang
试试?(不生成临时文件 dir.txt。)
PS:你把 qqgame.exe 删了,下次再玩岂不是要重装。
Try using this:
dir /a /s c:\qqgame.exe >nul 2>nul && goto zhang || dir /a /s d:\qqgame.exe >nul 2>nul && goto zhang || goto end
Instead of:
for %%1 in (c: d:) do @%%1 & dir QQGame.exe /s /a /b>>c:\windows\dir.txt
type c:\windows\dir.txt | find "QQGame.exe" /i
if errorlevel 1 goto end
if errorlevel 0 goto zhang
? (Without generating the temporary file dir.txt.)
PS: You delete qqgame.exe, and next time you play, you have to reinstall it.
|
|
2006-10-25 22:36 |
|
|
tianzizhi
高级用户
   
积分 622
发帖 214
注册 2006-9-22
状态 离线
|
『第 22 楼』:
使用 LLM 解释/回答一下
naturaljo上面的建议很好,简化了不少,也让我揣摩一会子,&&和||用的很好呀,对于nul空设备的用法我是不太熟悉的,你能否找些它的用法贴上好让大家看看呀,你上面的
>nul 2>nul的意思能说明白一下吗,谢谢,其实我也是菜鸟的,要多多学习呀,呵呵.
(向naturaljo解释一下,我机子是不装QQ游戏的,他们玩他们下载自己装,我的机子装了影子系统,开机游戏就没了.我不玩的,只是他们一玩就没有尾了,所有才想这用这个逗逗他们的,我现在在学批处理的,所以有了这个想法,用批处理实现,许多网友说用禁止,我也知道,这样的话我学习批处理还有什么用呢,学习它就要用它的对吧,其实我的最大目的不用禁止玩游戏,而是学习用批处理实现我的想法,学以致用.最后还要谢谢naturaljo的关心!!!!)
The suggestions on naturaljo are very good, which have simplified a lot, and also made me think for a while. && and || are used very well. I'm not very familiar with the usage of the nul empty device. Can you find some posts about its usage to let everyone have a look? Can you explain the meaning of >nul 2>nul above? Thank you. Actually, I'm also a novice and need to study a lot, hehe. (Explaining to naturaljo, my computer doesn't install QQ Games. They play and download and install by themselves. My computer has installed Shadow System, and the games are gone when I start up. I don't play them. Just because as soon as they play, it won't end, so I want to use this to tease them a bit. I'm currently learning batch processing, so I have this idea, to implement it with batch processing. Many netizens said to use prohibition, and I also know that. In this case, what's the use of my learning batch processing? To learn it is to use it, right? Actually, my biggest purpose is not to prohibit playing games, but to learn to implement my idea with batch processing and apply what I've learned. Finally, I also want to thank naturaljo for the concern!!!!)
|
|
2006-10-26 00:52 |
|
|
NaturalJ0
银牌会员
    
积分 1181
发帖 533
注册 2006-8-14
状态 离线
|
『第 23 楼』:
使用 LLM 解释/回答一下
贴段实例:
C:\Documents and Settings\J>dir test/b
找不到文件
C:\Documents and Settings\J>dir test/b 2>nul
C:\Documents and Settings\J>cd.>test
C:\Documents and Settings\J>dir test/b
test
C:\Documents and Settings\J>dir test/b >nul
C:\Documents and Settings\J>_
>nul 表示屏蔽标准输出
2>nul 表示屏蔽错误输出
结合上面的实例应该能看明白。
Here is the translation:
C:\Documents and Settings\J>dir test/b
File not found
C:\Documents and Settings\J>dir test/b 2>nul
C:\Documents and Settings\J>cd.>test
C:\Documents and Settings\J>dir test/b
test
C:\Documents and Settings\J>dir test/b >nul
C:\Documents and Settings\J>_
>nul means to shield the standard output
2>nul means to shield the error output
You should be able to understand it combined with the above example.
|
|
2006-10-26 01:44 |
|
|
tianzizhi
高级用户
   
积分 622
发帖 214
注册 2006-9-22
状态 离线
|
|
2006-10-26 04:03 |
|
|
bg888
社区乞丐
积分 -128
发帖 2
注册 2006-10-14
状态 离线
|
『第 25 楼』:
伟大领袖毛主席说:没有解决不了问题
使用 LLM 解释/回答一下
tianzihi的文章太好了。俺在这里找了好久都没有找到圆满在批处理中定时执行的问题,只好用VBS调用BAT,是你提到CHOICE /T,用此命令在BAT中定时是再好不过了!谢谢!
The article by tianzihi is really great. I've been searching here for a long time and haven't found a satisfactory solution to the problem of timing execution in batch processing. So I had to use VBS to call BAT. It's you who mentioned CHOICE /T, and this command is the best for timing in BAT! Thanks!
|
|
2006-10-31 11:06 |
|
|
freeskych
初级用户
 
积分 22
发帖 9
注册 2006-11-8
状态 离线
|
『第 26 楼』:
使用 LLM 解释/回答一下
组策略设置,禁止运行相应程序
Group policy settings to prohibit running corresponding programs
|
|
2006-11-8 12:03 |
|
|
jasonwang
初级用户
 
积分 122
发帖 54
注册 2006-11-3
状态 离线
|
『第 27 楼』:
使用 LLM 解释/回答一下
是基于qqgame.exe做检测吗?有目录限制没有,象我一般都是绿色版QQGAME,你这种方法不知道可行不?
Is it based on qqgame.exe for detection? Is there a directory restriction? Like me, I usually use the green version of QQGAME. I don't know if your method is feasible.
|
|
2006-11-9 06:30 |
|
|
anqing
高级用户
   
积分 859
发帖 413
注册 2006-8-14
状态 离线
|
『第 28 楼』:
使用 LLM 解释/回答一下
运行计化任务后,在进程里,有任务的进程吗?
关于schtasks这个命令,有没有详细的中文介绍和下载?
After running a scheduled task, is there a task-related process in the process?
Regarding the schtasks command, is there a detailed Chinese introduction and download?
|
|
2006-11-12 03:03 |
|
|
jxf123521
新手上路

积分 6
发帖 3
注册 2006-11-12
状态 离线
|
『第 29 楼』:
使用 LLM 解释/回答一下
感谢楼主的贴子,让我找到了学习这个的方法!
Thanks to the LZ's post, I found the way to learn this!
|
|
2006-11-12 13:40 |
|
|
htysm
高级用户
   
积分 866
发帖 415
注册 2005-12-4
状态 离线
|
『第 30 楼』:
使用 LLM 解释/回答一下
XP已经不支持choice 这个命令了。
楼主的钻研精神实在可嘉。
XP no longer supports the choice command.
The building spirit of the original poster is really commendable.
|
|
2007-1-24 06:30 |
|