I have written a small console program that checks that all my websites are up and running properly. I use the Microsoft Windows Task Scheduler to run this program automatically once a day.


The problem is that, quite naturally, the program steals focus every time it runs. I would prefer if it would start without becoming the top-most window on my desktop. What is the simplest way to achieve this? Of course, I could rewrite my EXE to create a background window (or no window at all), but it would be nice if the Task Scheduler had an option like "Do not steal focus" or something, but maybe that is not even possible...

3 Answers 3


You could have Task Scheduler run a vbscript that opens your console program. The vbscript can use the Shell Run method to open it minimized with something like:

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "notepad.exe", 6, true

There is some basic info about this at http://ss64.com/vb/run.html

  • 1
    I'd avoid VBScript purely because it is insecure and some shops don't allow it at all. However, this solution will work, so I'm voting it up.
    – user3463
    Apr 25, 2012 at 17:27
  • This works very well! I'll accept it. Apr 25, 2012 at 17:55
  • 1
    On Windows 7 I'd recommend PowerShell (Start-Process).
    – Bob
    Apr 25, 2012 at 18:48
  • I've used a method similar to this in the past to make windows invisible. Good call.
    – Melikoth
    Apr 25, 2012 at 19:25
  • 1
    This unfortunately prevents the Task Scheduler from correctly stopping the task and detecting if instances are already running. Long-running repeatable tasks frequently start running in parallel. May be a problem. Jul 28, 2012 at 9:52

Don't call the application directly. Run it from a shortcut that starts minimized.

I suppose you could also add a batch file into the mix that uses /start /min for the same effect, but I suspect the batch file will steal focus unless it is called from a shortcut that starts minimized.

EDIT: The start /min does steal focus very briefly, but it works on my machine, using a .cmd batch file that calls a new Command Line window (using cmd.exe).

My batch file looks like this:

@echo off
start /min C:\Users\Randolph\Desktop\shortcut.lnk

The shortcut itself opens cmd.exe and has default options selected, except that it opens minimized (the option Run: is set to Minimized).

  • Strangely, this doesn't work. I have created a shortcut that starts the EXE minimized, and when I doubleclick the shortcut (LNK file), the EXE is indeed started minimized. But when I tell Task Scheduler to start the LNK, the EXE is still not minimized. Apr 25, 2012 at 17:34
  • That's interesting. What happens with the start /min option? And does the task have the same privileges that you do? I'm wondering if this is to do with interacting with the desktop like some services do, where the permissions are slightly different. Geo's suggestion with VBScript may be the way to go.
    – user3463
    Apr 25, 2012 at 17:37
  • I've just noticed this: when I create a task using a shortcut, it ignores the shortcut and goes directly to the target. Perhaps this is what's happening with you and you need to paste the path to the lnk directly into the Program/Script box?
    – user3463
    Apr 25, 2012 at 17:42
  • I noticed that too, but I wasn't fooled by it. I had to write ahs.lnk manually in the task's properties. But still... Also, the BAT approach doesn't work. For some unknown reason, when run, the task opens a console window with the exe file as title, but the contents of cmd. Apr 25, 2012 at 17:43
  • The start /min worked on my computer, I'm sorry to say. I don't know what to suggest now.
    – user3463
    Apr 25, 2012 at 17:47

This syntax allows the start /min idea to work:
%comspec% /c start "" /min "C:\Scripts\Destination_inbound_ftp5.bat"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.