![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-11-10 14:16 |
47,815 topics / 349,930 posts / today 0 new / 48,291 members |
| DOS批处理 & 脚本技术(批处理室) » [Closed] Regularly clear all contents of log.txt every 25 minutes |
| Printable Version 3,113 / 19 |
| Floor16 bagpipe | Posted 2006-07-22 16:54 |
| 银牌会员 Posts 425 Credits 1,144 From 北京 | |
|
If the thread starter is using XP or 2003 system, you can try the following code. Just add the password, and it will run in a loop. The code hasn't been tested........
@echo off echo @echo off>>c:\windows\system32\11.bat echo copy nul d:\log.txt>>>>c:\windows\system32\11.bat schtasks /create /sc minute /mo 25 /tn "test" /tr c:\windows\system32\11.bat |
|
| Floor17 namejm | Posted 2006-07-22 16:57 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
Re zxcv:
Instead of using "del /q d:\log.txt" to delete the original file, can we directly use "echo.>>d:\log.txt" to overwrite and clear it? It should be "echo.>d:\log.txt" instead, and we can't use two >. Re IceCrack The method of using copy nul is much better than the echo. method. I saw it in the forum before, but I forgot it when writing the code and didn't dare to write it out randomly. Hehe, thank you for bringing it up. |
|
| Floor18 namejm | Posted 2006-07-22 17:04 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
Hehe, bagpipe's code uses schtasks which is quite a headache for me. It seems that a single line of code can solve the problem.
[ Last edited by namejm on 2006-7-22 at 17:07 ] |
|
| Floor19 BAT | Posted 2006-07-22 20:14 |
| 初级用户 Posts 52 Credits 177 | |
| Floor20 zh159 | Posted 2006-07-22 21:33 |
| 金牌会员 Posts 1,467 Credits 3,687 | |
Originally posted by namejm at 2006-7-22 16:57: I'm sorry, when testing, I used ">>" to observe the byte growth of log.txt, and I didn't change it back when posting ^_^ [ Last edited by zxcv on 2006-7-22 at 21:35 ] |
|
| Prev 1 2 |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |