In my program, I have a function runScript():
def runScript():
subprocess.call([\'echo\', \'hello\'])
I have seen many similar examples in
The echo
command is built in to the Windows shell, cmd.exe
. It is not an external program that can be called without the shell. Therefore, your subprocess.call()
needs to specify shell=True
.
subprocess.call('echo hello', shell=True)
(Also, the shell will handle splitting up the command for you, so I've used the simpler single-string style of passing the command.)