使用python调用下面的bat脚本并传入version等参数 @echo off set /p name=please input .bin source file name: echo, set /p version=please input OTA version : set /p mamufId=please input OTA manuf-id : set /p imageType=please input OTA image-Type : set /p tagId=please input OTA tag-Id : .\tools\image-builder\image-builder-windows.exe --create ".\file_ota\%name%.ota" --version %version% --manuf-id %mamufId% --image-type %imageType% --tag-id %tagId% --tag-file .\file_bin\%name%.bin echo, Pause
时间: 2024-03-29 12:40:04 浏览: 131
可以使用Python的subprocess模块来调用bat脚本并传递参数。代码如下:
``` python
import subprocess
name = input("please input .bin source file name: ")
version = input("please input OTA version: ")
mamufId = input("please input OTA manuf-id: ")
imageType = input("please input OTA image-Type: ")
tagId = input("please input OTA tag-Id: ")
cmd = r".\path\to\your\script.bat"
args = [name, version, mamufId, imageType, tagId]
subprocess.call([cmd] + args)
```
将上述代码中的`.\path\to\your\script.bat`替换为你的bat脚本所在的路径即可。
阅读全文