私のpythonプログラムの一部は、サブプロセスを使用してvbsスクリプトを開きます。他のプログラムからのコマンドを使用しようとしているPython 3.6
path = os.sep.join(['C:','Users',getpass.getuser(),'Desktop','Program','build','exe.win32-3.6','vbs.vbs'])
subprocess.call([sys.executable, path])
は、しかし、その代わりに、私のVBSスクリプトを実行するには、Pythonのコードとして、それを実行しようと、私に与えます:NameError:メッセージボックスが定義されていません。 そして、私は手動でvbsスクリプトを実行すると動作します。
私はPythonに通常vbsスクリプトを実行させます。 Pythonコードとして実行しないでください。
だから、正確にあなたの質問は何ですか? –
'sys.executable'はPythonインタープリタです。代わりに '.vbs'ファイルを実行する実行ファイルの名前を使用してください。 – mkrieger1
[Pythonで作成された引数でvbsファイルを実行する]の可能な複製(https://stackoverflow.com/questions/19112944/executing-a-vbs-file-with-arguments-created-by-python) – mkrieger1