【发布时间】:2016-08-04 03:21:04
【问题描述】:
我正在尝试创建一个脚本来运行我在特定项目中使用的所有工具(dor 实例、gulp、phpstorm、php 服务器等)
我想运行快捷方式而不是可执行文件。我可以在 Windows 中看到两种可能的实现方式:
- VbScript
- cmd.exe
很遗憾,我都失败了:
1) WshShell 触发 .lnk 文件,但我找不到替代方法:
为此,我正在尝试编写 .cmd 文件或 .vbs 但是,我在各个方面都遇到了问题。
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "notepad.exe" ' Works alright
WshShell.Run "C:\Users\eugene\Desktop\gulp EngMe.lnk" ' got an Exception: Unknown Exception
2) .cmd 脚本等待关闭之前启动的应用程序:
@rem urls and filesystem shortcuts start alright:
"C:\Users\eugene\Desktop\8000.url"
"C:\Users\eugene\Desktop\project_folder.lnk"
@rem the following two commands are starting sequentially, when the previous one has closed.
"notepad.exe"
@rem shortcut to %windir%\system32\notepad.exe:
"C:\Users\eugene\Desktop\Notepad_.lnk"
我做错了什么,还有其他方法可以做我正在尝试的事情吗?
【问题讨论】:
标签: batch-file vbscript cmd wsh