?
Solved

Get list of scheduled task

Posted on 2009-02-23
5
Medium Priority
?
595 Views
Last Modified: 2013-11-13
How can I get path of programs that are currently scheduled by the Windows tak Manager
0
Comment
Question by:c4rb0n
  • 3
5 Comments
 
LVL 31

Expert Comment

by:Frosty555
ID: 23709222
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
 

Author Comment

by:c4rb0n
ID: 23709635
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
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 375 total points
ID: 23710103
have a look at "Using the Task Scheduler" from http://www.mvps.org/emorcillo/en/code/vb6/index.shtml
0
 
LVL 31

Expert Comment

by:Frosty555
ID: 23713724
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
 
LVL 31

Expert Comment

by:Frosty555
ID: 23713734
Alternatively, you can look at this object-oriented method of reading scheduled tasks programatically:

http://www.codeproject.com/KB/cs/tsnewlib.aspx
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Make the most of your online learning experience.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Introduction to Processes

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question