cd
will work in a subprocess call.There is a
cwd
parameter that change directory.Also if pass commands as a string most have
shell=True
.It's better and safer to pass commands a list,then default is
shell=False
.Example:
import subprocess subprocess.run(['-d', 'f2803x', '-k', 'f28335_flash_kernel.txt', '-a', 'PQCR.i00', '-p', 'COM7', '-b', '9600', '-v'], cwd='C:\\ti\\c2000\\C2000Ware_1_00_04_00\\utilities\\flash_programmers\\serial_flash_programmer & serial_flash_programmer.exe')