Asynchronous Task Scheduler actions

4

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

mythofechelon

Posted 2012-11-01T16:24:34.910

Reputation: 653

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 – 2012-12-18T11:22:43.483

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 – 2012-12-18T11:37:57.360

Use CMD /C "start notepad.exe &" to start the programs. This might allow calling other jobs while previous are still running – mnmnc – 2012-12-18T15:26:52.623

@mnmnc Nope. Error: Windows cannot find 'C:\Program'. Make sure you typed the name correctly, and then try again. – mythofechelon – 2013-05-07T14:49:19.890

you must enclose the path to the program in double quotes. – mnmnc – 2013-05-07T15:14:35.547

While I can see at least one program there that you could want to run elevated, for the rest of the programs the usual startup locations would seem to suffice. – Neil – 2013-05-10T18:56:48.610

Answers

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.

aland

Posted 2012-11-01T16:24:34.910

Reputation: 498

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 – 2016-08-10T18:14:08.677

5I think you meant to say that task actions are serialised. – Neil – 2013-05-10T18:55:17.247

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 ).

http://dictionary.reference.com/browse/asynchronous

– aland – 2013-05-10T19:16:54.313

4

That's not the definition I'm used to. I did find this definition which matches my expectation: http://searchnetworking.techtarget.com/definition/asynchronous

– Neil – 2013-05-10T19:32:38.817

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

Christian Emm Riley

Posted 2012-11-01T16:24:34.910

Reputation: 21

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.

jdh

Posted 2012-11-01T16:24:34.910

Reputation: 6 645

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 – 2012-12-18T15:22:39.713

@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). – mythofechelon – 2013-05-07T14:14:05.223

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.

LPChip

Posted 2012-11-01T16:24:34.910

Reputation: 42 190