在Windows cmd脚本中添加到%TIME%变量 [英] Adding to %TIME% variable in windows cmd script
本文介绍了在Windows cmd脚本中添加到%TIME%变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我意识到这可能很容易在任何数量的其他脚本语言,但开始做它快速在cmd和现在我很好奇。
I realize that this could probably be done easier in any number of other scripting languages but started to do it quick in cmd and now Im curious.
相对于另一个进程开始的时间偏移的进程。让我们说5分钟,以保持简单。有没有办法添加到%TIME%变量?
Looking to start a process at an offset to the time that another process started. Lets say 5 minutes to keep it simple. Is there a way to add to the %TIME% variable?
例如:
start /b foo.exe
at %TIME% + 5 minutes bar.exe
$ b b
感谢任何帮助
Thanks for any assistance
推荐答案
我刚键入 set /?
I just typed set/?
and discovered cmd is much better than old bat... :-)
set h=%TIME:~0,2%
set m=%TIME:~3,2%
set/a m2="m+5"
set t2=%h%:%m2%
set t2
很明显,你可以得到62分钟等,我让你做额外的数学。 。:-D
Obviously, you can get 62 minutes, etc., I let you do the extra math... :-D
这篇关于在Windows cmd脚本中添加到%TIME%变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文