一个小脚本遇到的问题之 Windows 命令行启动程序
2016-04-01 10:56
357 查看
[size=11]
Windows命令行执行程序,吃力不讨好的事情,不过谁让咱们懒呢。试试呗。
以前记得有个start命令可以使用,当然网络上面很多说直接加入环境变量的,这个方法可以不过我没用。 Windows 的环境变量改来改去太麻烦。还是死磕start这个命令比较靠谱。
还真有,而且试过还不错。具体代码如下:
[/size]
[size=11]
上面这种形式比较安全。当然直接执行没有空格的路径也是可以的。具体可以参考这里:批处理启动多个程序
应该是能用,不过我的 Windows 8.1居然在命令行可以执行,写入bat文件居然不可以了。我就郁闷了。(换了一台其他的就可以,我实在是呵呵了。)
下面为了体谅我的老电脑,所以中间需要给个两三秒的休息时间。
参考的内容如下:http://stackoverflow.com/a/1672349
http://stackoverflow.com/a/1672375
[/size]
Windows命令行执行程序,吃力不讨好的事情,不过谁让咱们懒呢。试试呗。
以前记得有个start命令可以使用,当然网络上面很多说直接加入环境变量的,这个方法可以不过我没用。 Windows 的环境变量改来改去太麻烦。还是死磕start这个命令比较靠谱。
还真有,而且试过还不错。具体代码如下:
[/size]
start " " "full path"
[size=11]
上面这种形式比较安全。当然直接执行没有空格的路径也是可以的。具体可以参考这里:批处理启动多个程序
应该是能用,不过我的 Windows 8.1居然在命令行可以执行,写入bat文件居然不可以了。我就郁闷了。(换了一台其他的就可以,我实在是呵呵了。)
下面为了体谅我的老电脑,所以中间需要给个两三秒的休息时间。
参考的内容如下:http://stackoverflow.com/a/1672349
http://stackoverflow.com/a/1672375
[/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%
相关文章推荐
- 一个C#中调用命令行程序的问题
- windows命令行下随时随地调用csc编译器的方法(解决dos下编译.net程序找不到CSC的问题)
- 转载VS2008 编译出来的exe文件,运行遇到“应用程序配置不正确,程序无法启动”的问题
- 内文广告程序开发中遇到的一个问题
- CSDN博客:对于一个程序员,写程序就是实现功能,遇到具体问题,解决这个问题,并记录问题到CSDN上,从而有所提高和互相帮助。
- VS2008程序发布遇到“应用程序配置不正确,程序无法启动”问题的解决
- win7:windows已遇到一个关键性问题 一分钟后自动重启 无限重启win7 联网重启
- windows命令行下随时随地调用csc编译器的方法(解决dos下编译.net程序找不到CSC的问题)
- 在windows下安装opengrok遇到的一个问题
- WPF程序只允许一个启动在MVVMLight框架下找不到资源的问题
- windows中如何在命令行启动启动程序
- VS调试问题,程序无法正常启动 (使用openFlight_API中遇到的问题)
- 今天遇到一个问题:在程序中加入的定时触发器,当时出现这样一个问题,触发器定时2秒,程序从后台查询数据经过复杂处理后时间超过了2秒,我查阅好些网络上说有可能触发器等待程序执行完毕后,在触发下一次,也有说
- 在部署一个IIS7程序时的问题 模块列表中不存在为此处理程序指定的一个或多个模块。如果您尝试添加脚本 映射,则 IsapiModule 或 CgiModule 不会显示在模块列表中
- 重新想象 Windows 8 Store Apps (33) - 关联启动: 使用外部程序打开一个文件或uri, 关联指定的文件类型或协议
- msn问题 windows live messenger已停止工作,出现了一个问题,导致程序停止正常工作
- VC2005程序的一个运行错误 由于应用程序配置不正确,应用程序未能启动。重新安装应用程序可能会纠正这个问题。
- 最近写一个C#关于U盘的操作,在弹出U盘是遇到了些问题,C#调WINdoWs底层的东西太麻烦了,看样子要看看VC或C了
- 遇到一个诡异的regedit.exe程序问题
- 遇到一个IE升级到IE8之后脚本无法跑的问题。那么对于这样的问题,我们需要如何去处理?