0

I have this problem: What I am trying to do: Uninstall program in Windows via cmd.

For that I need to go to cmd, enter wmic, and then call uninstall on specific program and exit.

How do I do that in Python? I mean the commands should be passed in specific order in one session, as the first one runs some program, and the other enters a command for that program. All I have been using so far are just single commands that could be executed by whatever cmd session, and now I'm stuck.

Thanks in advance!

inzbartosz
  • 21
  • 2
  • 7
  • Why don't you create a batch file and run it from Python instead? – Selcuk Feb 11 '15 at 02:20
  • Or execute the same command lines directly, for that matter. – ivan_pozdeev Feb 11 '15 at 02:21
  • 1
    possible duplicate of [Calling an external command in Python](http://stackoverflow.com/questions/89228/calling-an-external-command-in-python) – ivan_pozdeev Feb 11 '15 at 02:21
  • Well, in batch file when I write "START wmic" - it starts in separate window and it is impossible to interact with it in that batch file. And I need to uninstall the program multiple times and the install it automatically. The installation part is done, I just can't uninstall it now. – inzbartosz Feb 11 '15 at 02:41
  • OK so the problem is solved - wmic takes the command also as an agrument, so can be fed directly via cmd in one line. – inzbartosz Feb 11 '15 at 02:46
  • However I still don't know how to hold a session in cmd in case I would ever need it... – inzbartosz Feb 11 '15 at 02:47

0 Answers0