1

can we write a script in python that runs dos commands/dos mode? Eg: I have a command

megarec.exe -cleanflash .1

which supposed to run only on dos mode.I do it manually.Now i need to write a script which automates the above procedure.can i do it?

Psyco-Pytho
  • 69
  • 1
  • 3

1 Answers1

0
import subprocess
ch=subprocess.Popen("megarec.exe -cleanflash .1",shell=True,stdout=subprocess.PIPE,stderr=subrocess.PIPE)
output,err=ch.communicate()
if output:
     print "success:",output
else:
     print "error:",error
vks
  • 67,027
  • 10
  • 91
  • 124