![]() |
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-09-24 11:22 |
47,812 topics / 349,917 posts / today 0 new / 48,274 members |
| DOS批处理 & 脚本技术(批处理室) » Problems with counting |
| Printable Version 2,570 / 22 |
| Floor16 jmz573515 | Posted 2007-01-07 05:52 |
| 银牌会员 Posts 464 Credits 1,212 | |
|
The principle of this VBS I wrote is like this.
Read the tmp.txt file. If it doesn't exist, it means it's the first run, then create the tmp.txt file and input "1" in it. If it exists, read the "1" inside, then add 1, rewrite this file. And display the number of times it runs. (Display according to the number in tmp.txt) BAT is something I'm completely incompetent with. :( Write my thoughts here for reference only. |
|
| Floor17 9527 | Posted 2007-01-07 05:53 |
| 银牌会员 Posts 438 Credits 1,185 From 北京 | |
|
Actually, this method is not good. If exiting the current CMD SHELL is invalid and the defined variable A is invalid, it is still seeking the best solution
[ Last edited by 9527 on 2007-1-7 at 05:54 AM ] |
|
| Floor18 namejm | Posted 2007-01-07 06:24 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
To calculate the number of runs without using the registry or temporary files, not only batch processing can't do it, but also other languages can't. Because the number of uses always needs to be stored in a place that is not easy to lose data, so that it can be read out next time. -- BTW, putting this number of uses in the batch file itself can also be regarded as using a temporary file, but it's just a disguised use.
|
|
| Floor19 vkill | Posted 2007-01-07 08:15 |
| 金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽 | |
Originally posted by namejm at 2007-1-7 06:24: Agreed |
|
| Floor20 scriptor | Posted 2007-01-07 10:07 |
| 银牌会员 Posts 555 Credits 1,187 | |
|
Since everyone says so, then it will end temporarily. Hehe
|
|
| Floor21 zh159 | Posted 2007-01-07 13:11 |
| 金牌会员 Posts 1,467 Credits 3,687 | |
|
There is a shortcoming in the code on my 6th floor: the batch file name cannot contain spaces.
Improvement to allow spaces: The file name cannot contain special symbols! The compiled batch file must have an empty line at the last line for a newline Test passed on XP SP2 [ Last edited by zh159 on 2007-1-7 at 12:15 AM ] |
|
| Floor22 26933062 | Posted 2007-01-07 13:42 |
| 银牌会员 Posts 879 Credits 2,268 | |
|
Didn't pay attention and there's already a good method, heh heh
[ Last edited by 26933062 on 2007-1-7 at 12:48 AM ] |
|
| Floor23 scriptor | Posted 2007-01-08 01:53 |
| 银牌会员 Posts 555 Credits 1,187 | |
|
Okay, very good
Is it possible to handle file names with spaces by adding 'type "%~nx0"'? |
|
| Prev 1 2 |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |