I want to perform some couple of command one after one and store into variable in same shell. Whenever I try to perform next command it executes in new shell
import subprocess
cmd1 = 'cd C:\\Program Files (x86)\\openvpn\\bin\\'
output = subprocess.getoutput(cmd1) # it goes to the above directory
cmd2 = 'openvpn.exe --help'
output2 = subprocess.getoutput(cmd2)
At the cmd2 when it runs,a new shell perform this command and tells-- 'openvpn.exe' is not recognized as an internal or external command, operable program or batch file.
I want to perform couple of commands one after another and store into variables. So I can use that variables in other commands.
tmp.cmd) and then run that file.tmp.cmd, then runtmp.cmdfrom Python. The alternative is to doos.chdir()in Python instead. The horrible version of this is to use thePexpectmodule and simulate input to a shell.