First, consider using native Python serial connection implementation, like pySerial, instead of running a console application (plink
).
See Full examples of using pySerial package.
Anyway if you run a Windows batch file that does what your Python code, it won't do what you want either:
start cmd /k plink.exe -serial COM4 -sercfg 115200,8,n,1,N
ifconfig
The ifconfig
is not a top-level command. It's something that needs to be executed by Plink.
You have to feed the command to the plink
standard input, see:
Execute a command on device over serial connection with Plink