This is the code that I want to run in cmd using python and I want it to return data with which I proceed in the program accordingly
SCHTASKS /query /TN TaskName >NUL 2>&1
As you can see, this code probably returns a false value if the TaskName is not found.
I want to get this data i.e: If the task does exist I need to get some error code back and need to get a different return code when it does exist.
I tried using
var=subprocess.Popen(["start", "cmd", "/k", "SCHTASKS /query /TN TaskName >NUL 2>&1"], shell = True)
print var
But this just gives me some object location in the memory presumably. Since this is using the help of cmd it seems to require a different syntax for returning.