For the sake of testing and personal proof of concept, I have a .exe file that only outputs a simple string and then calls a system pause (literally system("pause")
in C++).
I have a simple Python script I'm testing on a Windows XP VM that does these operations when messing up:
subprocess.call(r'echo Nothing special. > c:\blank.txt', shell=True)
subprocess.call(r'type pause.exe > c:\blank.txt:ads.exe', shell=True)
subprocess.call(r'start c:\blank.txt:ads.exe', shell=True)
subprocess.call(r'del c:\blank.txt', shell=True)
Obviously, those commands all work fine alone on the command line, why don't they work fine when called through Python?
I receive this pop-up error message:
blank.txt:ads.exe has encountered a problem and needs to close. We are sorry for the inconvenience.
If you were in the middle of something, the information you were working on might be lost.
The file is indeed deleted, also. It seems that the system pause is just crushed by the delete command, when I expect the .exe to pop up, wait for me to push enter, and then the script will continue and delete the file.