一个小脚本遇到的问题之 Windows 命令行启动程序

[size=11]
Windows命令行执行程序,吃力不讨好的事情,不过谁让咱们懒呢。试试呗。
以前记得有个start命令可以使用,当然网络上面很多说直接加入环境变量的,这个方法可以不过我没用。 Windows 的环境变量改来改去太麻烦。还是死磕start这个命令比较靠谱。
还真有,而且试过还不错。具体代码如下:
[/size]

start " " "full path"

[size=11]
上面这种形式比较安全。当然直接执行没有空格的路径也是可以的。具体可以参考这里:[url=http://blog.youkuaiyun.com/lwnylslwnyls/article/details/8333945]批处理启动多个程序[/url]
应该是能用,不过我的 Windows 8.1居然在命令行可以执行,写入bat文件居然不可以了。我就郁闷了。(换了一台其他的就可以,我实在是呵呵了。)
下面为了体谅我的老电脑,所以中间需要给个两三秒的休息时间。
参考的内容如下:[url]http://stackoverflow.com/a/1672349[/url]
[url]http://stackoverflow.com/a/1672375[/url]
[/size]

ping 127.0.0.1 -n 6 > nul
127.0.0.1 is the localhost IP address.
-n 6 There is a 1s delay between each ping, so for a 5s delay you need to do 6 pings.
nul gobble the output.

# 简单粗暴型
C:\> timeout 5
N.B. Please note however (thanks Dan!) that timeout 5 means:

Sleep anywhere between 4 and 5 seconds
This can be verified empirically by putting the following into a batch file, running it repeatedly and calculating the time differences between the first and second echos:

@echo off
echo %time%
timeout 5 > NUL
echo %time%

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值