在 windows cmd 脚本中添加到 %TIME% 变量 [英] Adding to %TIME% variable in windows cmd script

查看:15
本文介绍了在 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

感谢您的帮助

推荐答案

我刚刚输入 set/? 并发现 cmd 比旧的 bat 好多了... :-)

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆