I need to execute below command (and couple of other similar) to collect Windows OS event logs:
wmic nteventlog where filename="appevent" call BackupEventLog C:appevent.evt
The command executes successfully through cmd prompt. and collects file C:appevent.evt
But when i use Python os.system
or os.popen
to execute it retruns error.
Also if I create a .bat
file with the above command and execute the .bat
using os.system
it works
properly,
What is going wrong when I execute cmd using os.system
?
and How can I execute the command using Python?