|
scriptor
银牌会员
    
积分 1187
发帖 555
注册 2006-12-21
状态 离线
|
『楼 主』:
计数的问题
使用 LLM 解释/回答一下
怎么写一个批处理,让他自动的记住是第几次运行?
How to write a batch script that automatically remembers the number of times it has run?
|
|
2007-1-1 12:11 |
|
|
youxi01
高级用户
   
积分 846
发帖 247
注册 2006-10-27 来自 湖南==》广东
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
将运行次数写进一个文件或注册表吧
Write the number of runs into a file or the registry
|
|
2007-1-1 12:32 |
|
|
scriptor
银牌会员
    
积分 1187
发帖 555
注册 2006-12-21
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
不能在P中实现吗,不改写注册表,不用另外的文件?
Can't it be implemented in P without rewriting the registry and without additional files?
|
|
2007-1-1 12:46 |
|
|
youxi01
高级用户
   
积分 846
发帖 247
注册 2006-10-27 来自 湖南==》广东
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
当然也可以,不过稍微麻烦一点
Of course it's also possible, but it's a bit more troublesome
|
|
2007-1-1 12:53 |
|
|
scriptor
银牌会员
    
积分 1187
发帖 555
注册 2006-12-21
状态 离线
|
|
2007-1-1 13:11 |
|
|
zh159
金牌会员
     
积分 3687
发帖 1467
注册 2005-8-8
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
必须在批处理最后一行换行为空行
1、最简单的办法,在批处理中加入:
set/p=:<nul>>%~nx0
计算“:”的个数
2、显示当前运行次数:
@echo off
for /f "tokens=1,2* delims=:" %%i in ('findstr /nv "`" %~nx0') do set /a N=%%i-1
for /f "skip=%N% delims=" %%i in (%~nx0) do (
for %%n in (%%i) do set /a %%n+=1)
set /a :+=1
echo.&echo. 第 %:% 运行。&echo.
set/p=: <nul>>%~nx0
pause
exit
The last line of the batch processing must be an empty line
1、The simplest way is to add in the batch processing:
set/p=:<nul>>%~nx0
Calculate the number of ":"
2、Display the current running times:
@echo off
for /f "tokens=1,2* delims=:" %%i in ('findstr /nv "`" %~nx0') do set /a N=%%i-1
for /f "skip=%N% delims=" %%i in (%~nx0) do (
for %%n in (%%i) do set /a %%n+=1)
set /a :+=1
echo.&echo. The %:% run. &echo.
set/p=: <nul>>%~nx0
pause
exit
|
|
2007-1-1 16:25 |
|
|
scriptor
银牌会员
    
积分 1187
发帖 555
注册 2006-12-21
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
Many Thanks
Happy New Year
Many Thanks
Happy New Year
|
|
2007-1-2 01:07 |
|
|
scriptor
银牌会员
    
积分 1187
发帖 555
注册 2006-12-21
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
调试了
很好的
不过还要研究一下,我还没有仔细看代码
先谢谢了
It has been debugged. It's very good. But I still need to study it. I haven't looked at the code carefully yet. Thanks first.
|
|
2007-1-2 01:09 |
|
|
scriptor
银牌会员
    
积分 1187
发帖 555
注册 2006-12-21
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
那个代码由问题啊
只能记到2
往后就总是2,谁来解决??
There is a problem with that code? Can only remember to 2, and then always 2, who will solve it?
|
|
2007-1-7 02:28 |
|
|
jmz573515
银牌会员
    
积分 1212
发帖 464
注册 2006-12-13
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
是不是可以用VBS写一个,怪我无知,汗~~
Last edited by jmz573515 on 2007-1-22 at 10:16 PM ]
Is it possible to write one with VBS? Blame me for being ignorant, sweat~~
Last edited by jmz573515 on 2007-1-22 at 10:16 PM ]
|
|
2007-1-7 04:55 |
|
|
scriptor
银牌会员
    
积分 1187
发帖 555
注册 2006-12-21
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
waw。。。
又来了一个vbs的
呵呵。。。。
好的,谢谢。
waw...
Here comes another VBS one
Hehe......
Okay, thank you.
|
|
2007-1-7 04:59 |
|
|
scriptor
银牌会员
    
积分 1187
发帖 555
注册 2006-12-21
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
能不能只用BAT的格式把这个问题解决阿?
谢谢
Can we can solve this problem only in BAT format? Thanks
|
|
2007-1-7 05:00 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
演示代码:
@echo off
:: 只有在不关闭这个脚本的情况下才能计数
:loop
cls
set /a num+=1
echo 这是第 %num% 次运行
pause
goto loop
Demonstration code:
@echo off
:: Only count when this script is not closed
:loop
cls
set /a num+=1
echo This is the %num%th run
pause
goto loop
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2007-1-7 05:18 |
|
|
scriptor
银牌会员
    
积分 1187
发帖 555
注册 2006-12-21
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
我要的不是这个情况,我说的是每次运行就一次数
怎么实现?只用bat
What I want is not this situation. What I mean is that every time it runs, it counts once. How to achieve it? Only using bat
|
|
2007-1-7 05:37 |
|
|
dikex
高级用户
    潜水修练批处理
积分 788
发帖 366
注册 2006-12-31
状态 离线
|
『第 15 楼』:
使用 LLM 解释/回答一下
echo 内容 >> 批处理自身
使用这个就可以了
原理大致这样,有兴趣作出一些修正之类的
Last edited by dikex on 2007-1-6 at 04:45 PM ]
echo content >> batch file itself
Just use this
The principle is roughly like this, if you are interested, you can make some corrections and so on
Last edited by dikex on 2007-1-6 at 04:45 PM ]
|
|
2007-1-7 05:43 |
|