vbs从任何位置运行ps1

时间:2016-04-22 12:53:39

标签: vbscript

我试图通过VBS运行ps1脚本,但只有在给出PS1的完整路径时才能为我工作。 c:\ scripts \ test.ps1

使用完整路径 Set objShell = CreateObject("Wscript.Shell") objShell.Run("powershell.exe -noexit c:\scripts\test.ps1") 但我需要我可以将脚本移动到那里的不同位置,因为固定路径对我来说不起作用。

我尝试将PS1放入相同的文件夹中,而vbs仍然无法使其正常工作

不能用作objShell.Run(&#34; powershell.exe -noexit test.ps1&#34;)或objShell.Run(&#34; powershell.exe -noexit。\ test.ps1&#34;)< / p>

任何帮助appriciated。

1 个答案:

答案 0 :(得分:0)

尝试执行以下操作以引用脚本的本地目录。

super().apply_async(...)