Board logo

标题: 请各路高手帮忙解决批处理计算的问题 [打印本页]

作者: h99h99     时间: 2009-9-15 11:07    标题: 请各路高手帮忙解决批处理计算的问题
我有一个文本文件1.txt,内容如下:

abc def ghij trtr trtrt trtrtt tttty 4545454
0 4 4865 255 63 78156225 38162 5LA8D5MX

我要取第三行的 78156225 再减个常数如 64 作为下面的命令参数,
test.exe 0 78156255-64 /r


用批出来如何来实现,请各路高手帮忙!!

作者: Hanyeguxing     时间: 2009-9-15 12:48
1,如果1.txt中就这三行,则:
for /f "tokens=6" %%a in (1.txt) do set /a a=%%a-64
test.exe 0 %a% /r


2,如果超过三行,则:
for /f "tokens=1,7 delims=: " %%a in ('findstr /n .* 1.txt') do if %%a equ 3 set /a a=%%b-64
test.exe 0 %a% /r

作者: h99h99     时间: 2009-9-16 00:05
Originally posted by Hanyeguxing at 2009-9-15 12:48:
1,如果1.txt中就这三行,则:
for /f "tokens=6" %%a in (1.txt) do set /a a=%%a-64
test.exe 0 %a% /r


2,如果超过三行,则:
for /f "tokens= ... 



你太有才了!不相识的大师,谢谢你了!经过测试你的代码运行正如你所说,满足了我的要求。本人还有个问题,不知道大师能否用批处理来帮我实现。就是运行一个批处理(test.bat)后,第3天后的每天的 11:30 至 13:30定时执行 test1.bat,再次谢谢,同时感谢 联合 dos 论坛 为我们提供这么好的学习交流平台 。

作者: netbenton     时间: 2009-9-16 02:26
后门?

作者: Hanyeguxing     时间: 2009-9-16 04:14
看 Schtasks /?的帮助

作者: h99h99     时间: 2009-9-16 05:14
Originally posted by netbenton at 2009-9-16 02:26:
后门?



不是后门,杀毒或者播放音乐等。

作者: h99h99     时间: 2009-9-16 05:14
Originally posted by Hanyeguxing at 2009-9-16 04:14:
看 Schtasks /?的帮助

谢谢指点!

作者: zzybq     时间: 2009-9-17 00:33
。。。。。看不明白

作者: yishanju     时间: 2009-9-17 01:52