Does anyone know how to set a scheduled task to run in background using Windows Task Scheduler?
There doesn't seem to be any option to do this.
Asked
Active
Viewed 2.4e+01k times
166

Samuel Liew
- 76,741
- 107
- 159
- 260
-
1@AlexS - check [this one](http://superuser.com/questions/641150/how-to-run-a-process-in-the-background-without-keeping-a-batch-file-open) – npocmaka May 04 '16 at 08:06
-
1Maybe will help somebody: https://www.howtogeek.com/tips/how-to-run-a-scheduled-task-without-a-command-window-appearing/ – X-factor Aug 29 '17 at 11:52
-
If you are running PowerShell script, here is the solution https://superuser.com/a/1038142/106079 – BBK Jun 26 '18 at 22:12
2 Answers
237
As noted by Mattias Nordqvist in the comments below, you can also select the radio button option "Run whether user is logged on or not". When saving the task, you will be prompted once for the user password. bambams noted that this wouldn't grant System permissions to the process, and also seems to hide the command window.
It's not an obvious solution, but to make a Scheduled Task run in the background, change the User running the task to "SYSTEM", and nothing will appear on your screen.

Will
- 334
- 3
- 9

Samuel Liew
- 76,741
- 107
- 159
- 260
-
66So basically it's »Either I see something on my screen or the application gets beyond-administrator privileges«? Doesn't sound too good ... – Joey Jul 04 '11 at 08:05
-
15+1 Solved my problem, thanks! But why does the user account being used have anything to do with the visibility of the window, and why does the "Hidden" checkbox, which sounds like it should do this, not do anything? – Joshua Frank Sep 21 '12 at 19:01
-
16Yeah, while this is a good tip, it's a bad solution. The task ends up running with system priveleges, can intentionally or unintentionally do harm. If it accesses the internet someone may compromise your system. It runs with different user profile so %USERPROFILE% will resolve to a different place. It won't see your documents (unless you hardcode paths). Files it creates may be unaccessible to you (unless you also switch to admin). – himself Oct 05 '13 at 21:58
-
17In case anyone else comes across this. I found this solution on serverfault which doesn't require escalating privileges. http://serverfault.com/questions/9038/run-a-bat-file-in-a-scheduled-task-without-a-window – bronsoja Jan 13 '14 at 17:32
-
39There is another way of doing this with another possibly more acceptable side-effect. Just check the "Run whether user is logged on or not" checkbox. This will run the program in the background. You'll have to provide the user password once when clicking ok though. – Mattias Nordqvist Apr 01 '14 at 12:15
-
1thanks, the best solution. Note: you need to put "SYSTEM" in your language, in my case is Portuguese: SISTEMA – Vagner do Carmo Mar 08 '15 at 05:37
-
5`why does the "Hidden" checkbox, which sounds like it should do this, not do anything` @JoshuaFrank, that checkbox does not run the program hidden, it hides the task in the Task Scheduler. You can toggle showing hidden tasks on and off via `View→Show Hidden Tasks`. This is (probably) a way to reduce clutter in the scheduler. – Synetech Oct 02 '15 at 20:36
-
@MattiasNordqvist - this doesn't appear to work for non-basic triggers, such as "Whenever any user unlocks the PC" - changing to SYSTEM was necessary in this case – Coruscate5 Mar 06 '17 at 17:22
-
2wow. scary part of this is I was able to get a script to run as system user but didn't even have to run the scheduler as admin to do it. wtf. Did I miss something or is this a security flaw bigtime? – tkarls Aug 15 '17 at 08:03
-
Agree with @bambams. Also, there is no need to provide the user password. Just use the appropriate checkbox ("Do not store user password"). – Borislav Aymaliev Sep 27 '18 at 09:41
-
I found I couldn't use the "Run whether user is logged in or not" as I was trying to use `robocopy` to my OneDrive online drive and it wouldn't work. Running a `SYSTEM` did. Since it's just a simple copy, I'm okay with that (I think). – Hendy Aug 21 '19 at 03:08
-
1This doesn't work when the task was created with a domain user since there is no SYSTEM object. – Oxy Synth Oct 04 '19 at 12:29
9
Assuming the application you are attempting to run in the background is CLI based, you can try calling the scheduled jobs using Hidden Start
Also see: http://www.howtogeek.com/howto/windows/hide-flashing-command-line-and-batch-file-windows-on-startup/

Jay Sidri
- 6,271
- 3
- 43
- 62
-
3There is no need to download a new program, Windows comes with one already. It's called `start /b` – BlueRaja - Danny Pflughoeft Jul 19 '12 at 17:51
-
7The problem with `start` is that its a command not a program, so you cannot use it in Task Scheduler. – Erik Kaplun Sep 16 '12 at 12:21
-
4`cmd.exe /c start` does the trick for commands which are not programs. – hypersw Jun 24 '13 at 16:32
-
33@hypersw ...which, in turn, leads to a command prompt showing while the task is running. :) – Camille Sep 26 '13 at 16:56
-
4@hypersw, Cammille is correct, the system still creates a console window for the `cmd` process and the `start` command, so you still end up with a console window which at the very least flashes for a moment. It just defers the problem (and adds an extra and unnecessary level of abstraction to the issue. – Synetech Oct 02 '15 at 20:08
-
2@Synetech you can hide the cmd window by using vbs. Set objShell = CreateObject("WScript.Shell") objShell.Run "your command", 0 – Anixx Sep 30 '17 at 06:48