2

I am looking for solution, I want to disable/enable the particular device in windows system using devcon.exe in python script. I am able to disable/enable using devcon.exe windows cmd.exe separately but i am looking for this activity to done using python script to verify 10 iteration.

I need to automate one test case which will has to verify the disabling/enabling particular device in windows using devcon.exe for 10 iteration continuously and record log.

Tirth Patel
  • 5,443
  • 3
  • 27
  • 39
  • Are you looking for how to call `devcon.exe` from a Python script, or do you need some other means to disable the device? The former should be easy with something like `subprocess.call` (or a similar function). The latter may be much harder. – Blckknght Apr 02 '16 at 20:08
  • HI, I am able to use devcon.exe for disabling and enabling the same, this loop has to be continues for 10 times. Can u help to here – Saravanan Thaangaraj May 25 '16 at 10:37
  • So what have you tried? Stack Overflow is not a code writing service. You should try to solve the problem yourself, then ask a specific question about any problems you run into. There's lots of documentation and tutorials about using Python to call subprocesses. Try one (maybe you can even find one in your native language!) and then come back if you have more specific questions. – Blckknght May 25 '16 at 11:48
  • There seems to be a problem running devcon from system 32, please refer to [Budlog's answer](https://stackoverflow.com/questions/44631966/executing-devcon-cmd-command-from-python ) He moved devcon to sysWOW64 and trapped the error code. – DarkLight Jun 21 '18 at 08:43

1 Answers1

-1

I know this is very late. But your problem can be solved by the subprocess module. Let me know if you are unable to find what you need, and I will then post the code. Thanks

A Saxena
  • 165
  • 2
  • 13
  • 7
    You should definitely post the code, so that not every future reader of this Q/A needs to figure it out again from scratch. – Baum mit Augen May 08 '17 at 22:13