Apr-02-2019, 02:57 PM
Dear all,
I have found the way to communicate between python and batch file. Below is my python and batch file. As you can see it is not that pretty as I am passing variables one at the time(variable[0],variable[1]).
However, the solution below will become unsustainable once "variables" vector becomes larger.
Any suggestions?
@echo off
set arg1=%1
set arg2=%2
set arg3=%3
set /a vari1=%arg1%
set /a vari2=%arg2%
set /a vari3=%arg3%
I have found the way to communicate between python and batch file. Below is my python and batch file. As you can see it is not that pretty as I am passing variables one at the time(variable[0],variable[1]).
However, the solution below will become unsustainable once "variables" vector becomes larger.
Any suggestions?
variables = ['2000','3000','4000'] item = subprocess.Popen(['batch_multiple_variables.bat', variables[0],variables[1],variables[2]] , shell=False, stdout=subprocess.PIPE)My batch code:
@echo off
set arg1=%1
set arg2=%2
set arg3=%3
set /a vari1=%arg1%
set /a vari2=%arg2%
set /a vari3=%arg3%