Invoke scheduled task from batch?


  1. Posts : 720
    Win10 x64 Pro - 2 desktops, 2 laptops
       #1

    Invoke scheduled task from batch?


    Is there any way to invoke a scheduled task from a script? I know the tasks can be manually invoked from the Task Scheduler's GUI so maybe there's a way to do it programmatically. Yes?
      My Computer


  2. Posts : 14,046
    Windows 11 Pro X64 22H2 22621.1848
       #2

    See here: schtasks.exe

    Running a Task

    The following syntax is used to immediately run a scheduled task.

    syntax
    schtasks /Run
    [/S system [/U username [/P [password]]]]
    /TN tasknam
      My Computers


  3. Posts : 720
    Win10 x64 Pro - 2 desktops, 2 laptops
    Thread Starter
       #3

    Cool! Thank you.
      My Computer


  4. Posts : 14,046
    Windows 11 Pro X64 22H2 22621.1848
       #4

    You're welcome.
      My Computers


  5. Posts : 16,963
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #5

    You seem to be sorted but here is an example that I have in one of my own batch scripts -
    Code:
    C:\Windows\System32\SCHTASKS.exe /run /tn "BackupRegistry"

    You can get the syntax of the SCHTASKS command by entering this in a command window
    Code:
    SCHTASKS /?

    There is also guidance in
    schtasks - MSDocs
    schtasks - SS64

    Denis
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 12:37.
Find Us




Windows 10 Forums