6

Explanation

I want to run a few programs / files on logon, so I'm using Task Scheduler, rather than the Startup folder or scripts, because certain programs require UAC elevation and Task Scheduler's "Run with highest privileges" will suppress prompts, I believe.

 

Problem

The first action never exits properly, so, as task actions are synchronous, only the first action is ever run.

So, does anyone know how to make tasks asynchronous or have any other suggestions?

 

Setup

Startup - Triggers Startup - Actions

6
  • why would you use task scheduler for starting programs after logon? Use the startup location under "All programs". Copy the shortcuts to executables to this folder and it will run all programs after you login. Task scheduler is for somethin else.
    – mnmnc
    Dec 18, 2012 at 11:22
  • if you absolutely must use task scheduler then create a .bat file to start the programs for you and place the bat file in scheduled task.
    – mnmnc
    Dec 18, 2012 at 11:37
  • 1
    Use CMD /C "start notepad.exe &" to start the programs. This might allow calling other jobs while previous are still running
    – mnmnc
    Dec 18, 2012 at 15:26
  • @mnmnc Nope. Error: Windows cannot find 'C:\Program'. Make sure you typed the name correctly, and then try again. May 7, 2013 at 14:49
  • you must enclose the path to the program in double quotes.
    – mnmnc
    May 7, 2013 at 15:14

4 Answers 4

3

I came here based on a comment discussion on SO

Honestly, I have programs in my startup menu which require admin privledges that seem to run fine without any intervention on my part.

Have you tried to put these programs in the Group Policy Logon/off Scripts? Under Computer Configuration, Windows Settings. I'm not sure if this will work for you. There may be some other solution based on Group Policies - but they go a bit over my head.

However, I came to post my comment as requested - which I've modified it based on your actual question:

Task Scheduler tasks run in sequence rather than simultaneously. If you want all tasks to run at the same time (in parallel) the easiest would be to create multiple tasks to run at the same time (or on the same event, e.g. At Logon). Use the 'Delay task' advanced option to stagger their start order if desired.

5
  • 5
    I think you meant to say that task actions are serialised.
    – Neil
    May 10, 2013 at 18:55
  • I wrote what I meant to say a·syn·chro·nous [ey-sing-kruh-nuhs] adjective 1. not occurring at the same time. 2. (of a computer or other electrical machine) having each operation started only after the preceding operation is completed. 3. Computers, Telecommunications. of or pertaining to operation without the use of fixed time intervals ( opposed to synchronous ). dictionary.reference.com/browse/asynchronous
    – aland
    May 10, 2013 at 19:16
  • 4
    That's not the definition I'm used to. I did find this definition which matches my expectation: searchnetworking.techtarget.com/definition/asynchronous
    – Neil
    May 10, 2013 at 19:32
  • Running in a sequence means the tasks run serially, whereas "asynchronous" means that the tasks run without respect to the timing of the others, meaning Task 2 can run before or after Task 1; it's start does not depend on the completion of Task 1.
    – palswim
    Aug 10, 2016 at 18:14
  • Use the 'Delay task' advanced option, but where is it (which tab of the task scheduler)?
    – JinSnow
    Jun 10, 2020 at 9:38
2

I have a batch file that starts each program. Because I want all the programs to run asyncronously AND also with a delay between each one (as the first 2 programs take around 10-15 seconds to fully start-up), I use 'ping localhost -n 15 >nul' between each program line for the delays.

Works very well and means I only have one Task in TS.

Example batch file:

@echo off
::Start prog 1
"C:\Program Files\prog1\prog1.exe"

::Need to wait 15 seconds for it to start
ping localhost -n 15 >nul

:: Start prog 2
:: Further progs & delays here if required, etc,etc...
0

Because the first program in the list of actions that started is still running, the waiting script handler in the task scheduler will never run the second program until the first completes. It's meant to start either a single program/action or a series of short running actions. Here, you want to run each action as a separately scheduled task.

2
  • That is exacly why i suggested to use the startup as it allows concurrent starts. Also bat script will provide a wait time and multiple concurrent execution of programs.
    – mnmnc
    Dec 18, 2012 at 15:22
  • @mnmnc But I wish to start programs that require UAC elevation (Fraps, for example) but without the actual prompt coming up, which scheduling a task can do and the startup folder cannot (as far as I know). May 7, 2013 at 14:14
0

You can run a scheduled task from a batch file by using the following command:

C:\Windows\System32\schtasks.exe /run /tn "????????"

Where ???????? is the name of the scheduled task. For example, if you create a folder under Task Scheduler Library named MyApps, and under that you create a task called Fraps, your command will look like this:

C:\Windows\System32\schtasks.exe /run /tn "MyApps\Fraps"

You can even use this in a shortcut to launch fraps directly without UAC.

But in this case, I would simply start Fraps first, then in the General tab tick the option Run Fraps when Windows starts.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .