Get list of scheduled task

Posted on 2009-02-23
Last Modified: 2013-11-13
How can I get path of programs that are currently scheduled by the Windows tak Manager
Question by:c4rb0n
    LVL 31

    Expert Comment

    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

    Author Comment

    Mmm.. I am making simple startup scanner using vb6.
    Is there any intenal command coz I want to put the path to listbox/listview
    LVL 69

    Accepted Solution

    have a look at "Using the Task Scheduler" from
    LVL 31

    Expert Comment

    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.
    LVL 31

    Expert Comment

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

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
    Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    732 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

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now