I have troubles with the task scheduler in windows 7 Pro. I want to run a script. Manual execution works perfectely, the task manager does nothing.
Part of the script is setting the focus onto a specific window using this VBScript:
Dim ObjShell :Set ObjShell = CreateObject("Wscript.Shell")
ObjShell.AppActivate("Notepad")
The 2 lines above are only part of the bigger script, but for error checking I excluded everything else. First I have to get that running then the original.
Notepad is open of course and manually executing the vbs sets the focus. Running the script using task scheduler does not set the focus. I even ran the script manually in task scheduler (rightclick - run) - does not set focus.
The task is run with elevated privileges and with the same user as manual start. The computer is not shut down, not locked.
Why does the script run manually but not in task scheduler? How can I get it to run in task scheduler?
€dit: I want to run the vbs file, not a .bat file if possible, as I do not want a cmd window to open.
cscript.exe
and see if it will execute.