我有一个带有两个参数的Python脚本,我想通过VBscript运行它。问题是,当我在windows命令行中手动键入command时,它可以正常工作。当我想从.vbs文件调用相同的脚本时,它不会运行.py文件。一个新的命令窗口出现并迅速消失。.vbs中的脚本是:
SET oShell = WScript.CreateObject("Wscript.Shell")
currentCommand = "D:\xxxx\xxxxx.py aaaa bbbbbbb"
WScript.echo currentCommand
oShell.run currentCommand,1,True
将“python”添加到currentCommand时没有区别。 我也这样试过:
SET oShell = WScript.CreateObject("Wscript.Shell")
Dim source_code_path
source_code_path = "D:\xxxx\xxxxx.py"
Dim variable1
variable1 = "aaaa"
Dim variable2
variable2 = "bbbbbbb"
Dim currentCommand
currentCommand = source_code_path & " " & variable1 & " " & variable2
WScript.echo currentCommand
oShell.run currentCommand,1,True
如何使用.vbs文件中的多个参数调用/运行.py文件?
注意:当我在没有参数的情况下调用/运行另一个.py时,它可以正常工作。
尝试将其更改为:
相关问题 更多 >
编程相关推荐