When I execute a simple command like "net start", I get the output successfully, as shown below.
Python script:
import os def test(): cmd = ' net start ' output = os.popen(cmd).read() print output test()
Output:
C:\Users\test\Desktop\service>python test.py These Windows services are started: Application Experience Application Management Background Intelligent Transfer Service Base Filtering Engine Task Scheduler TCP/IP NetBIOS Helper The command completed successfully. C:\Users\test\Desktop\service>
But when I execute long commands (for example: "net start" search for windows "), I DO NOT get any output.
Python script:
import os def test(): cmd = ' net start "windows search" ' output = os.popen(cmd).read() print output test()
Output:
C:\Users\test\Desktop\service>python test.py C:\Users\test\Desktop\service>
I tried searching for "net start \" windows \ "". also. But the same problem.
Can anyone participate in this for me?
source share