need to to add scheduled task in c#

Posted on 2011-10-24
Last Modified: 2013-12-16
i have following code that does not work in xp.
i tested with other commands such as chkdsk,  it worked, but when using schtasks it dose not work again.
can someone please help?
string command="schtasks /create /sc once /tn restart /tr \"c:\\windows\\system32\\shutdown.exe -r -t 60\" /st 11:20 /ru system";

            System.Diagnostics.ProcessStartInfo psinfo;

            System.Diagnostics.Process pro = new System.Diagnostics.Process();

            psinfo = new System.Diagnostics.ProcessStartInfo("cmd", "/c "+command);

            pro.StartInfo = psinfo;

Open in new window

Question by:Ikelca

    Accepted Solution

    ok found whats wrong,
    the time has to be hh:mm:ss

    Author Closing Comment

    found solution myself

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (…
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    779 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

    11 Experts available now in Live!

    Get 1:1 Help Now