我有一个启动exe(甚至是没有gui的进程(的vb脚本:
strCom = "Start calc"
WSHShell.Run(strCom)
它不会启动程序,当我打开任务管理器时,我看不到它。
但是当我直接在命令行中写入命令"Startcalc"时,它会打开它
我该如何使用脚本?
start
内置于cmd.exe
;这不是一个实际的程序。
WSHShell.Run
采用物理文件,而不是内置的cmd
。
因此,您可以编写WSHShell.Run("calc.exe")
-
启动类似calc.exe或cmd.exe 的系统进程
代码
Dim shl Set shl = CreateObject("Wscript.Shell") Call shl.Run("""calc.exe""") Set shl = Nothing WScript.Quit
-
启动正常过程
代码
Dim shl Set shl = CreateObject("Wscript.Shell") Call shl.Run("""D:testvbssomeServices.exe""") Set shl = Nothing WScript.Quit
-
您也可以使用VBscript启动任何批处理文件。只需在shl.run((中提供批处理文件的路径,同时调用它.
或者/此外-如果使用start
很重要:
CreateObject("WScript.Shell").Run "%comspec% /c start /wait notepad.exe", 0, True
CreateObject("WScript.Shell").Exec "%comspec% /c start E:HandapparatAlgorithmsdiktaat.pdf"
分别。其一些变体。
CreateObject("WScript.Shell").Run("**Application**")
我不打算为这个剧本制作视频。尽管我确实用它做了一个很酷的错误游戏。