I have several processes scheduled in my Windows 7 environment, mainly for backups, that are supposed to run in the background.

However instead of just doing it's work quietly in the background, the task scheduler pops up a black (console like) "taskeng.exe" window. The window goes in front of all other windows. Luckily it doesn't steal my keyboard focus, but it blocks the view on everything.

taskeng.exe

Is there a way to avoid this window - or at least have it appear in the background without stealing my VISUAL focus?

link|improve this question

40% accept rate
feedback

4 Answers

You could run the scheduled tasks as a different user, that way they will no interact with your normal account's interactive desktop at all. This certainly seems to work on the Windows2003 servers I administer. Just be careful to make sure that file permissions and other authentication details are set such that the tasks can access what they need to when un as this different user.

Edit: Or instead of running a console tool directly you could have a small script that runs it using WScript.Shell.Run with the "minimise, no focus change" option:

' sample script: c:\scripts\test.vbs
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "c:\location\of\tool\utility.exe", 7

then run this with the task scheduler (the command line being something like wscript c:\scripts\test.vbs) instead of calling the tool directly. You should be able to call batch files and other scripts that way too. There is also a "completely hide" option (replace the 7 above with a 0), though in either case the hide/minimise only controls the initial window: if the tool opens more itself then they may still steal focus as before.

See http://msdn.microsoft.com/en-us/library/d5fk67ky%28VS.85%29.aspx for a full list of options for the run method.

link|improve this answer
I'm afraid that's not possible because I need my kerberos credentials for some of the tasks. – BlaM Nov 12 '10 at 15:57
You could try running the task indirectly and using the windows scripting host's run method which allows you some control of how the initial window of a task is presented. See edit. – David Spillett Nov 13 '10 at 13:01
feedback

Here's the SyncToy script I use. Notice the multiple quotes around the file location:

' SyncToy Scheduler
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run """C:\Program Files\SyncToy 2.1\SyncToyCmd.exe"" -R" ,7
link|improve this answer
feedback

Try 4trayMinimizer. You can define apps that are hidden by default.

link|improve this answer
feedback

Try running your scheduled task like this:

C:\Windows\System32\cmd.exe /c start /b c:\fullpath\mybackup.bat

The start /b should start the application without creating a new window.

If this does not work, then you can create an standalone AutoIt script that will hide the taskeng.exe window. AutoIt scripts can be compiled to a .exe.

The .exe would be the first line in your mybackup.bat file. The AutoIt code would look like this:

WinSetState("taskeng", @SW_HIDE)
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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