使用/key=val调用subprocess.call不正确n

2022-07-06 12:52:02 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图在Windows上执行以下命令(命令在CMD中工作) "D:\xxxx\tool.exe" /RunScript="C:\xxxx\scdm.py" /Headless=True /Splash=False /Welcome=False /ExitAfterScript=True /ScriptArgs="C:\xxx\file.sat"

PS路径缩短,如果需要,我可以提供完整路径

我正在使用subprocess.call,但似乎忽略了参数

command = [scdm_dir, r'/RunScript="{}"'.format(scdm_script_path),
           r"/Headless=True", r"/Splash=False", r"/Welcome=False", r"/ExitAfterScript=True",
                  r'/ScriptArgs="{}"'.format(os.path.join(os.getcwd(), "Fluent", "fluent.sat"))]

  print(command)
  subprocess.call(command)```

output of print is:
>>> ['D:\xxxx\tool.exe', '/RunScript="C:\xxxx\scdm.py"', '/Headless=True', '/Splash=False', '/Welcome=False', '/ExitAfterScript=True', '/ScriptArgs="C:\xxx\file.sat"']

Tags: 命令falsetruetoolexesatcommandheadlesswelcomesplashxxxxrunscriptscdmscriptargsexitafterscript