focus - Stop taskeng.exe window from popping up

25
2014-05
  • BlaM

    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?

    Example edited in after bounty applied:

    Here is my last attempt at using the WScript stuff (in a file named RunSignatured.bat):

    Set Shell = CreateObject("WScript.Shell")
    Shell.Run C:\Users\danh\Bin\signatured.bat, 0, False
    

    The signatured.bat file contains:

    cd C:\Users\danh\bin
    "C:\Program Files\Java\jre7\bin\java.exe" Signature
    
  • Answers
  • techie007

    More specifically to Daniel R Hicks' bounty/example, but I think it can still be applied to the original problem:

    If it's a batch file being launched from Task Scheduler, then instead of just launching the Batch file minimized/invisible, you probably also need to modify the batch file itself to run it's commands invisibly.

    So change:

    cd C:\Users\danh\bin
    "C:\Program Files\Java\jre7\bin\java.exe" Signature
    

    To something like:

    cd C:\Users\danh\bin
    start /b "C:\Program Files\Java\jre7\bin\java.exe" Signature
    

    Or perhaps eliminate the batch file completely and just do everything from the (VBS) script you're launching directly from the Task Scheduler.

    Something like:

    Set Shell = CreateObject("WScript.Shell")
    Shell.CurrentDirectory = "C:\Users\danh\bin" 
    Shell.Run "C:\Program Files\Java\jre7\bin\java.exe Signature", 0, False
    

    Solution as implemented by DanH, in response to techie007's suggestions, satisfying the bounty:

    One file, named RunSignatured.vbs, containing:

    Set Shell = CreateObject("WScript.Shell")
    Shell.CurrentDirectory = "C:\Users\danh\bin" 
    Shell.Run "java.exe Signature", 0, False
    

    Note that the above relies on java.exe being in path, since the technique does not work with the blank in Program Files when specifying a full path. There are no doubt other ways to work around this problem, but that's for others to discover.

    Then add RunSignature.vbs as the "program/script" name in the "Action" in Task Scheduler.

  • David Spillett

    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.

  • slhck

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

  • jftuga

    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)
  • Carl

    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
    
  • harrymc

    Apparently you have installed SQLyog MySQL GUI, which has scheduled the execution of the SQLyog Job Agent. It looks like it is a console application that does not try to hide itself.

    You should look in the Task Scheduler for a task referring to SQLyog and correct its entry. If it is a cmd call, try to add /b to the parameter list. If it is just a call to an executable, you could correct it in view of this answer of mine.

    If you have troubles locating this entry, use autoruns to find how SQLyog is started. You could also use regedit to search for all mentions of SQLyog or whatever is the name of its installation directory.

    You could of course also uninstall SQLyog MySQL GUI, if you don't need it.

    If you have not installed SQLyog MySQL GUI, then your computer might be infected. You could use Process Monitor to verify when the popup appears, to see whether it is the taskeng.exe from system32 or one of the Look alikes of Taskeng.exe.

  • Ered

    i was having the exact problem using SQLyog after doing some research i fixed it creating a file called invisible.vbs and inserting this code:

    Set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.CurrentDirectory = "C:\Program Files (x86)\SQLyog\"
    WshShell.Run "SJA.exe C:\Users\REPLACE_UR_USER\Desktop\test.xml -lC:\Users\REPLACE_UR_USER\AppData\Roaming\SQLyog\sja.log -sC:\Users\REPLACE_UR_USER\AppData\Roaming\SQLyog\sjasession.xml ", 0
    

    Than create a Task Scheduler to run the invisible.vbs file and that's it!


  • Related Question

    focus - Stop windows from activating themselves
  • manilow

    I play poker online. When a decision is required, the relevant window activates and brings itself in front of all other windows, so that I can act in time. However, I can pay attention to all opened poker tables on my own, and thus, this feature has little to offer me. It can get extremely annoying though, for example when I start typing something into an email but suddenly get switched mid-air to the poker table chat box.

    Fortunately, some of the more advanced poker software has an option to turn off this aggressive behavior. However, others don't. Is there any kind of system tweak or tool that can block software from activating its windows? I want to be in total control regarding what window is active, at least for my poker playing sessions.

    I use Windows XP.


  • Related Answers
  • Tom

    Microsoft's Tweak UI for Windows XP can help with this. Once installed, go to the General Settings --> Focus and check the "Prevent Applications from stealing focus" box. It will continue to flash the button in the taskbar, but you can limit that.

  • Peter Mortensen

    You may have a look at Actual Window Manager then (it's not free, but far more sophisticated than Eusing's Auto Window Manager).

    • Actual, Window Manager is shareware, try before you buy (60 days evaluation period).*

    Personally, I swear by this extraordinary piece of software.

  • harrymc

    See the free Eusing Auto Window Manager:

    Auto Window Manager automatically manages any window you specify. For instance, some web browsers open up in a non-maximized window. Using Auto Window Manager, you can set those windows to automatically maximize (minimize, normal, minimize to tray, stay on top) every time they opened. It works with almost any program, including web browsers, Notepad, etc. Auto Window Manager stays running in the system tray, so it stays out of your way while it works.

    • Automatically maximize or minimize or normal all new windows you specify.
    • Automatically minimize all new windows you specify to system tray.
    • Automatically keep all new windows you specify always on top.