View Single Post
Old 02-13-2013, 05:11 PM   PM User | #5
Raphael
New Coder

 
Join Date: Mar 2009
Posts: 70
Thanks: 3
Thanked 3 Times in 3 Posts
Raphael is an unknown quantity at this point
Quote:
Originally Posted by Fou-Lu View Post
It sounds like a permission issue. Try redirecting the stderr as well: schtasks.exe /query /tn "repost_labor" 1> d:\scripts\labor\scheduled\repost_labor.txt 2>&1 to see if that puts any errors in the file (I think I've got the redirection correct :P).
The return value of 1, is likely an error. Apps should be returning 0 on success, but there's nothing error message wise to tell what's going on.
Great idea about the error redirection!

I tried it and got this error:

Code:
ERROR: The system cannot find the path specified.
Which is very strange. To narrow down which file it couldn't find (schtasks.exe or repost_labor.txt) I took out the file redirection part so it was just trying to execute this:

Code:
c:\windows\system32\schtasks.exe /query /tn "repost_labor"
and it gave the same error.

How is it possible that it can't "find" schtasks.exe at this point in the program to do a query and just a few lines later it uses almost the same command to create a scheduled task?
Raphael is offline   Reply With Quote