Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Windows Scheduled Tasks - Get schedule details by program name

Status
Not open for further replies.

steve4king

IS-IT--Management
Feb 6, 2007
154
0
0
US
I'm trying to find out whether a specific executable has been scheduled, if so, where that file is located.

For example, if notepad.exe is scheduled and being run from f:\somefolder\notepad.exe. I need to get "f:\somefolder\"

I'm coding this in Delphi, but I'm not finding a suitable API.. so as a consolation, I'm looking at just running dos commands.

I'm not super good with batch, and this is as far as I've gotten:
Code:
schtasks /query /V /FO CSV | grep -i "NOTEPAD.EXE"

This returns a long string that contains the info I need:

Code:
File STDIN:
"MyWorkstation","\run something","11/02/2011 1:26:35 PM","Ready","Interactive only","N/A","1","MyUserName","F:\somefolder\Notepad.exe ","N/A","N/A","Enabled","Disabled","Stop On Battery Mode, No Start On Batteries","MyUserName","Enabled","72:00:00","Scheduling data is not available in this format.","Weekly","N/A","N/A","N/A","WED","Every 1 w
eek(s)","Disabled","Disabled","Disabled","Disabled"

Does anyone know of a more direct way in the form of windows api or even a cmd string that will just return "f:\somefolder\notepad.exe" in this example?


Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top