Get list of scheduled task

How can I get path of programs that are currently scheduled by the Windows tak Manager
c4rb0nAsked:
Who is Participating?
 
Éric MoreauConnect With a Mentor Senior .Net ConsultantCommented:
have a look at "Using the Task Scheduler" from http://www.mvps.org/emorcillo/en/code/vb6/index.shtml
0
 
Frosty555Commented:
You can use Vb's Shell() function to execute the following command:

schtasks /query /v /fo csv >results.csv

To populate somefile.csv with a comma separated values list of all the information for all the scheduled tasks on the computer. One of the columns is called "Task to run", that's the path to the executable.

You can also change the /fo arguement to return the scheduled tasks as a list, or as a more human-readable table.

schtasks /query /v /fo list >results.txt
schtasks /query /v /fo table >results.txt
0
 
c4rb0nAuthor Commented:
Mmm.. I am making simple startup scanner using vb6.
Is there any intenal command coz I want to put the path to listbox/listview
0
 
Frosty555Commented:
c4rb0n: call the above command. Then you can read in that file using VB and parse out whatever information you want. If you're comfortable reading CSV data in using VB, you can store it in that format. If, however, you will find it easier reading line-by-line, then use the LIST style of output. This makes it extremely easy. As you read, you populate the listboxes.

I'm sure there might be a way to do it with WMI rather than using this command line utilty, but it will be significantly more complex for very little gain.
0
 
Frosty555Commented:
Alternatively, you can look at this object-oriented method of reading scheduled tasks programatically:

http://www.codeproject.com/KB/cs/tsnewlib.aspx
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.