This leads to a bigger problem I am having here with Popen()
.
The following does not do what I thought it should:
x = subprocess.Popen("cmd.exe echo a", stdout=PIPE, shell=True)
print (x.stdout.read())
Returns the "title" message of the cmd console, but echo a
is never executed.
Same with:
x = subprocess.Popen(["cmd.exe", "echo a"], stdout=PIPE)
print (x.stdout.read())
and
cmd = "cmd.exe echo a"
x = subprocess.Popen(shlex.split(cmd), stdout=PIPE)
print (x.stdout.read())
End result is in open cmd terminal that prints the standard "Microsoft Windows version..." and a CLI position of C:\Python36>
.