Sep-04-2018, 10:34 AM
I changed it a bit adding
This is the code:
It still asks me for password and to verify it so it's not working yet.
flush()
but I still can't figure it to work. This is the code:
from subprocess import * p = Popen(['cmd', '/k', 'Command that does something and asks for a password'], stdin=PIPE) p.stdin.write(b'test\r\n' *2) p.stdin.flush()I also removed the
shell=True
because it's not recommended in the python subprocess docs. If you remove it you need to add 'cmd', '/k'
to make it work. The /k will open the terminal and run the command or you can run /c to just run it without opening a terminal.It still asks me for password and to verify it so it's not working yet.