|
tianzizhi
高级用户
   
积分 622
发帖 214
注册 2006-9-22
状态 离线
|
『楼 主』:
求一即时删除文件的批处理程序!!!
使用 LLM 解释/回答一下
我不想让别人在我的机子上玩QQ游戏,也不好意思直说,但想让安装QQ游戏后不让它运行,我是这样想的,在我的机子搜索游戏的主程序qqgame.exe只要发现它就马上删除它,这样qq游戏就不能玩了,所以想求一在内存中驻存的批处理文件,只要发现有qqgame.exe这个文件就立刻删除它,但要求这个批处理不能占用太多cpu.我的cpu低,请各位高手帮忙了,谢谢!
Last edited by tianzizhi on 2006-10-15 at 11:42 ]
I don't want others to play QQ games on my computer, and I'm too embarrassed to say it directly. But I want to prevent QQ games from running after installing them. Here's my idea: search for the main program of the game qqgame.exe on my computer. As soon as I find it, delete it immediately, so that QQ games can't be played. So I'm asking for a batch file that resides in memory. As soon as it finds the qqgame.exe file, it deletes it immediately. But it's required that this batch file doesn't occupy too much CPU. My CPU is slow. Please, all you experts, help. Thank you!
Last edited by tianzizhi on 2006-10-15 at 11:42 ]
|
|
2006-10-15 10:45 |
|
|
zh159
金牌会员
     
积分 3687
发帖 1467
注册 2005-8-8
状态 离线
|
|
2006-10-15 10:49 |
|
|
electronixtar
铂金会员
      
积分 7493
发帖 2672
注册 2005-9-2
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
设置文件夹的权限即可
Just set the permissions of the folder.
|

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>" |
|
2006-10-15 10:49 |
|
|
tianzizhi
高级用户
   
积分 622
发帖 214
注册 2006-9-22
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
我只有管理员帐户的,不想用权限设置,况且也不能确定游戏目录的安装位置的,C盘安装不成可以换成其实盘的,所以这个方法不太行噢,我还是想要可以满足要求的批处理程序的.请高手们动动脑筋了,谢谢!!!!!!!!!!!
Last edited by tianzizhi on 2006-10-15 at 11:09 ]
I only have an administrator account and don't want to use permission settings. Moreover, I can't be sure of the installation location of the game directory. If the C drive can't be installed, I can change to another disk, so this method doesn't work very well. I still want a batch program that can meet the requirements. Please, experts, use your brains. Thanks!!!!!!!!!!!
Last edited by tianzizhi on 2006-10-15 at 11:09 ]
|
|
2006-10-15 11:07 |
|
|
3742668
荣誉版主
      
积分 2013
发帖 718
注册 2006-2-18
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
利用脚本的确可以满足楼主的要求,不过楼主同时说要顾及系统性能,那么建议楼主通过修改注册表来实现吧.例如:
Windows Registry Editor Version 5.00
"RestrictRun"=dword:00000001
"1"="regedit.exe"
"2"="notepad.exe"
"3"="explorer.exe"
保存上面的字符到 禁止程序运行.reg ,然后双击导入注册表.接着结束explorer.exe并立即启动explorer,就只能运行 注册表编辑器,记事本,和explorer了.如果你还有其他需要运行的程序,则在下面依次加上编号和程序路径.
如果你觉得上面的方法不大合适的话也可以用vbs脚本,不过需要付出大概将近7Mb左右的内存吧.
Using a script can indeed meet the building owner's requirements, but the building owner also said to take into account system performance, so it is recommended that the building owner implement it by modifying the registry. For example:
Windows Registry Editor Version 5.00
"RestrictRun"=dword:00000001
"1"="regedit.exe"
"2"="notepad.exe"
"3"="explorer.exe"
Save the above characters to "Prohibit Program Execution.reg", then double-click to import the registry. Then end explorer.exe and start explorer immediately, and only regedit.exe, notepad.exe, and explorer.exe can be run. If you have other programs that need to be run, then add the number and program path in turn below.
If you think the above method is not quite appropriate, you can also use a vbs script, but it will cost about nearly 7MB of memory.
|
|
2006-10-15 11:09 |
|
|
tianzizhi
高级用户
   
积分 622
发帖 214
注册 2006-9-22
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
请3742668版主把批处理文件或脚本贴出来吧,我想试试,谢谢!!
Please let moderator 3742668 post the batch file or script, I want to try it, thank you!!
|
|
2006-10-15 11:14 |
|
|
lxmxn
版主
       
积分 11386
发帖 4938
注册 2006-7-23
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
楼主可以试试下面的代码,也是将其保存为.reg文件,双击运行即可达到你的目的。
Windows Registry Editor Version 5.00
"1"="poco.exe"
"2"="qqgame.exe"
"3"="qq.exe"
可以在上面依次添加你不想运行的程序。
The poster can try the following code, save it as a.reg file, and double-click to run it to achieve your purpose.
Windows Registry Editor Version 5.00
"1"="poco.exe"
"2"="qqgame.exe"
"3"="qq.exe"
You can add the programs you don't want to run one by one above.
|
|
2006-10-15 11:55 |
|
|
tianzizhi
高级用户
   
积分 622
发帖 214
注册 2006-9-22
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
以上大侠的注册表方案是可行的,但不是我最想要的,我还不是我最想要的,经过我一天多的一点点探索,我终于找到我想要的方案了,在这小弟我向大家公布一下的我的探索过程,供大家学习,有不对的地方请大家指教.
我最近在学习批处理,对它很有兴趣,所以才坚持让它来实现的我的想法.
我想让这段程序驻留在内存中随时监控qqgame.exe等类似文件存在,若有的话马上删除到,刚开始我想的是目录安在C盘,
用的命令是:
@echo off
if exist c:\"program files"\tencent\qqgame\qqgame.exe del c:\"program files\tencent\qqgame\qqgame.exe
(那个双引号是我摸索半天才想到的,不加它的话,就会一直提示:系统无法找到路径.我郁闷了半天,难道是目录层次太多,又拿了d盘作实验,结果不管多少目录都可以找到路径,突然想起programe files 是两个单词,是否因为这个呢,先加了单引号,不行,又加了双引号,行了,很高兴)
虽然这个可以,但有两个毛病:一是不是随时监控的,二是目录确定的太死板,改下目录就不管用了.
为了改进它,我又用到了for 命令:
@echo off
for %%1 in (c: d:) do @del %%1\qqgame*.* /s /a
想想怎么一直执行这个命令呢,想到了再循环一次,用了以下命令:
@echo off
:zhang
for %%1 in (c: d:) do @del %%1\qqgame*.* /s /a
goto zhang
这样在我的机子执行了一下
我靠我的cpu都让它用完了,这还了得,它是个死循环了,得另换法了,
我又想能能让for %%1 in (c: d:) do @del %%1\qqgame*.* /s /a
定期执行一次呢,这样cpu就可以休息一下了
我想到了at命令 用at /?一查,希望又没了,它是最小单位是天啊,我反不能一天执行一次吧,算了,再换吧.
我用help看一下还没有别的好的命令
终于让我查到schtasks这个命令,这个命令应该是windows2003特有的,其它系统好像没有,它的用处实在是太强大了,比at要强几百倍,下面附一点它的资料:
Schtasks
安排命令和程序,使其定期运行或在指定时间运行。向计划中添加任务和从中删除任务、根据需要启动和停止任务以及显示和更改计划的任务。
要查看该命令语法,请单击以下命令:
? schtasks create
? schtasks change
? schtasks run
? schtasks end
? schtasks delete
? schtasks query
schtasks create
计划任务。
Schtasks 针对各种计划类型使用不同参数组合。要查看创建任务的组合语法或查看使用特定计划类型创建任务的语法,请单击以下选项之一。
? 组合语法和参数描述
? 计划任务每 N 分钟运行一次
? 计划任务每 N 小时运行一次
? 计划任务每 N 天运行一次
? 计划任务每 N 周运行一次
? 计划任务每 N 月运行一次
? 计划任务在周的指定天运行
? 计划任务在月份的指定周运行
? 计划任务在每月的特定日期运行
? 计划任务在月份的最后一天运行
? 计划任务运行一次
? 计划任务在每次系统启动时运行
? 计划任务在用户登录时运行
? 计划任务在系统空闲时运行
? 计划任务现在运行
? 计划任务以不同权限运行
? 计划任务以系统权限运行
? 计划任务运行多个程序
? 计划任务在远程计算机上运行
组合语法和参数描述
语法
Schtasks /create /sc ScheduleType /tn TaskName /tr TaskRun User ]] User | System}] | *] ] ]
看了半天用了以下命令:
schtasks /create /u 用户名 /p 密码 /sc minute /mo 1 /tn "即时删除" /tr d:\a.bat
a.bat的内容为:
@echo off
for %%1 in (c: d:) do @del %%1\qqgame*.* /s /a
这样看似可以了,但我还有要求,它的最低间隔时间是1分钟,我觉得时间太长,我想15秒
就执行一次,这个先放这吧,再找一下.
我又查看了一会,让我找到了choice这个命令里的/t参数,t的作用是做出默认的选择前,暂停的秒数,它的单位是秒,这正是我想要的,哈哈,机会来了,让我想到下的命令:
@echo off
:zhang
for %%1 in (c: d:) do @del %%1\qqgame*.* /s /a
choice /t 15 /d y
goto zhang
我保存为a.bat
打开后,发现它是一窗口,不能消失,我想让它在后台运行,找一下相关资料,我觉得用vbs脚本不错,又写了下面的脚本:
set ws=WScript.CreateObject("WScript.Shell")
ws.Run "d:\a.bat",0
保存为b.vbs
这样再运行一下,哈哈,成功了,它在后台运行了,每隔15就会检查机器里有无qqgame*.*这样的文件,有的话就马上删除了,终于实现了我的愿望.
后来我在网上搜了一下,又找到一方法,没有试,不知行不行:
@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=%%j+1
set /a next_hour=%%i
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
)
)
at !next_hour!:!next_minute! c:\settimerun.bat
rem 这里是具体所要执行的命令,可以根据需要自己调整
copy c:\windows\system32\notepad.exe d:\notepad.exe
endlocal
@echo on
The above experts' registry solutions are feasible, but not what I most want. I haven't got what I most want yet. After more than a day of my little by little exploration, I finally found the solution I want. Here, I, the younger brother, would like to announce my exploration process to everyone for everyone's study. Please give your advice if there is anything wrong.
Recently I'm learning batch processing and am very interested in it, so I insist on making it realize my idea.
I want this program to stay in memory and monitor the existence of files like qqgame.exe at any time. If there is any, delete it immediately. At first, I thought the directory was on drive C.
The command used is:
@echo off
if exist c:\"program files"\tencent\qqgame\qqgame.exe del c:\"program files\tencent\qqgame\qqgame.exe
(That pair of double quotes was what I just thought of after fumbling for a long time. Without them, it would keep prompting: The system cannot find the path. I was depressed for a long time. Could it be that the directory level is too much? Then I did an experiment on drive D. As a result, no matter how many directories there are, the path can be found. Suddenly I remembered that "programe files" is two words. Is it because of this? First I added single quotes, it didn't work. Then I added double quotes, it worked. I was very happy)
Although this works, there are two problems: one is that it is not monitoring at any time, and the other is that the directory is determined too rigidly. It won't work if the directory is changed.
To improve it, I also used the for command:
@echo off
for %%1 in (c: d:) do @del %%1\qqgame*.* /s /a
I thought about how to execute this command all the time. I thought of looping again and used the following command:
@echo off
:zhang
for %%1 in (c: d:) do @del %%1\qqgame*.* /s /a
goto zhang
Then I executed it on my computer
Oh my god, my CPU was used up by it. That won't do. It's an infinite loop. I have to change another way.
I also thought about being able to make for %%1 in (c: d:) do @del %%1\qqgame*.* /s /a execute regularly. Then the CPU can have a rest.
I thought of the at command. I checked with at /? and then my hope was gone. Its minimum unit is day. I can't execute it once a day. Forget it. Change again.
I used help to see if there were other good commands.
Finally I found the schtasks command. This command should be unique to Windows 2003. Other systems seem not to have it. Its use is really too powerful. It is hundreds of times stronger than at. The following is a little information attached:
Schtasks
Arrange commands and programs to run regularly or at a specified time. Add tasks to the plan, delete tasks from it, start and stop tasks as needed, and display and change scheduled tasks.
To view the command syntax, click the following commands:
? schtasks create
? schtasks change
? schtasks run
? schtasks end
? schtasks delete
? schtasks query
schtasks create
Schedule a task.
Schtasks uses different parameter combinations for various schedule types. To view the combined syntax for creating a task or to view the syntax for creating a task using a specific schedule type, click one of the following options.
? Combined syntax and parameter description
? The scheduled task runs every N minutes
? The scheduled task runs every N hours
? The scheduled task runs every N days
? The scheduled task runs every N weeks
? The scheduled task runs every N months
? The scheduled task runs on specified days of the week
? The scheduled task runs on the specified week of the month
? The scheduled task runs on a specific date of the month
? The scheduled task runs on the last day of the month
? The scheduled task runs once
? The scheduled task runs every time the system starts
? The scheduled task runs when the user logs on
? The scheduled task runs when the system is idle
? The scheduled task runs now
? The scheduled task runs with different permissions
? The scheduled task runs with system permissions
? The scheduled task runs multiple programs
? The scheduled task runs on a remote computer
Combined syntax and parameter description
Syntax
Schtasks /create /sc ScheduleType /tn TaskName /tr TaskRun User ]] User | System}] | *] ] ]
After reading for a long time, I used the following command:
schtasks /create /u Username /p Password /sc minute /mo 1 /tn "Immediate Deletion" /tr d:\a.bat
The content of a.bat is:
@echo off
for %%1 in (c: d:) do @del %%1\qqgame*.* /s /a
It seemed to work, but I also had a requirement. Its minimum interval time is 1 minute. I think it's too long. I want it to execute once every 15 seconds. Let's put this aside first. I looked for it again.
I also checked for a while and found the /t parameter in the choice command. The function of /t is the number of seconds to pause before making the default selection. Its unit is seconds. This is exactly what I want. Ha ha, the opportunity came. I thought of the following command:
@echo off
:zhang
for %%1 in (c: d:) do @del %%1\qqgame*.* /s /a
choice /t 15 /d y
goto zhang
I saved it as a.bat
After opening it, I found it was a window and couldn't disappear. I wanted it to run in the background. I looked for relevant information. I thought that using a vbs script was good. Then I wrote the following script:
set ws=WScript.CreateObject("WScript.Shell")
ws.Run "d:\a.bat",0
Saved as b.vbs
Then I ran it again. Ha ha, it succeeded. It runs in the background. It checks whether there are files like qqgame*.* in the machine every 15 seconds. If there are, it deletes them immediately. Finally my wish was realized.
Later I searched on the Internet and found another method. I didn't try it. I don't know if it works:
@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, you can adjust it yourself as needed
set /a next_minute=%%j+1
set /a next_hour=%%i
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
)
)
at !next_hour!:!next_minute! c:\settimerun.bat
rem Here is the specific command to be executed, you can adjust it yourself as needed
copy c:\windows\system32\notepad.exe d:\notepad.exe
endlocal
@echo on
|
|
2006-10-16 00:03 |
|
|
vkill
金牌会员
     
积分 4103
发帖 1744
注册 2006-1-20 来自 甘肃.临泽
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
禁止非法程序好了
Just prohibit illegal programs is okay
|
|
2006-10-16 00:07 |
|
|
tianzizhi
高级用户
   
积分 622
发帖 214
注册 2006-9-22
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
我想学的是一种新思维,并用我所学的知识实现它,思考探索的过程很有趣,各位高手若有其它奇妙的想法贴出来大家学习噢!
(不要光想着如何如何禁止它,从另外角度来思考,就算它安装好了,但如果破坏了它的任何文件,或改变了它的原始路径,或文件重新命名了,它照样运行不起来,是不是呀,这些应如何实现呢,大家平时多思考一下吧,换个角度思考,你会发现你的思维灵活了很多)
I want to learn is a new way of thinking, and use what I have learned to implement it. The process of thinking and exploring is very interesting. All you experts, if you have other wonderful ideas, post them for everyone to learn!
(Don't just think about how to prohibit it. Think from another angle. Even if it is installed, but if any of its files are damaged, or its original path is changed, or the file is renamed, it still can't run, right? How to achieve these? Everyone usually think more, change the angle to think, you will find that your thinking is much more flexible)
|
|
2006-10-16 04:43 |
|
|
vkill
金牌会员
     
积分 4103
发帖 1744
注册 2006-1-20 来自 甘肃.临泽
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
Originally posted by tianzizhi at 2006-10-16 04:43:
我想学的是一种新思维,并用我所学的知识实现它,思考探索的过程很有趣,各位高手若有其它奇妙的想法贴出来大家学习噢!
(不要光想着如何如何禁止堮..
呵呵
Originally posted by tianzizhi at 2006-10-16 04:43:
I want to learn a new way of thinking and implement it with the knowledge I've gained. The process of thinking and exploring is very interesting. If any of the experts have other wonderful ideas, please post them for everyone to learn!
(Don't just think about how to ban...
Hehe
|
|
2006-10-16 04:50 |
|
|
redtek
金牌会员
     
积分 2902
发帖 1147
注册 2006-9-21
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
顶!!!
|

Redtek,一个永远在网上流浪的人……
_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._ |
|
2006-10-16 05:28 |
|
|
lxmxn
版主
       
积分 11386
发帖 4938
注册 2006-7-23
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
终于让我查到schtasks这个命令,这个命令应该是windows2003特有的,其它系统好像没有,它的用处实在是太强大了,比at要强几百倍
这个schtasks命令不只是windows2003特有的吧,在我的Windows XP sp2上面也有。
是应该好好的学习一下这个命令了,谢谢提醒。
Finally, I found the schtasks command. This command should be unique to Windows 2003, and it seems that other systems don't have it. Its function is really too powerful, hundreds of times stronger than at.
This schtasks command is not unique to Windows 2003. I also have it on my Windows XP sp2.
I should really study this command well. Thank you for the reminder.
|
|
2006-10-16 05:37 |
|
|
yiping1973
初级用户
 
积分 71
发帖 34
注册 2006-9-15
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
高!高!
这个schtasks命令
我也是应该好好的学习一下这个命令了,谢谢提醒。
Hi! Hi!
This schtasks command
I should also study this command well, thank you for the reminder.
|
|
2006-10-21 06:50 |
|
|
sanhu35
初级用户
 
积分 31
发帖 15
注册 2006-8-18
状态 离线
|
『第 15 楼』:
使用 LLM 解释/回答一下
从LZ的帖看到了LZ的成长
感觉我对批处理的认识也成长1些
LZ我可以要下你的QQ吗
我的QQ 37730533 你+我也可以
副:批处理 我就知道了
From LZ's post, I saw LZ's growth.
I feel that my understanding of batch processing has also grown a bit.
LZ, can I have your QQ?
My QQ is 37730533. You can add me too.
PS: For batch processing, I just know this much.
|
|
2006-10-25 10:35 |
|
|