【发布时间】:2014-12-16 03:39:43
【问题描述】:
我正在创建一个 VBScript,它将从命令提示符运行 Exchange PowerShell 命令。
当我尝试运行下面的脚本时,出现了expected end of statement。
Dim oShell
Set oShell = WScript.CreateObject ("WScript.Shell")
oShell.run "cmd.exe ""C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"" -psconsolefile ""C:\Program Files\Microsoft\Exchange Server\V14\Bin\exshell.psc1"" -file ""C:\script\script.ps1"" "
请帮我解决这个问题。
【问题讨论】:
-
我确信还有更多内容,但在这种情况下从另一个 shell 调用 shell 是多余的。我会从中删除
cmd组件。另外,你没有说错误发生在哪里。当然,我希望它在第 3 行,但是您实际上是脚本中的<br>吗?那会导致错误吗? -
您是否有理由不只使用 PowerShell。在您的情况下,Cscript 调用 Cmd 调用 PowerShell ?
标签: windows powershell vbscript cmd