Page 2 of 2 FirstFirst 12
  1.    04 Jan 2017 #11
    Join Date : Aug 2016
    S/E England
    Posts : 4,782
    10 Home x64 (1709) (10 Pro on 2nd pc)

    Quote Originally Posted by Chris Nicola View Post
    In any case, I have UAC turned off.
    Glad to have helped you get it working. If you had UAC turned off just to try to get this working, I'd turn it back on now. It's there to prevent malware making changes without your permission.
      My ComputersSystem Spec
  2.    04 Jan 2017 #12
    Join Date : Aug 2016
    Posts : 25
    Windows 10
    Thread Starter

    Thanks for the advice. Actually I had it turned off for other reasons. I just turned UAC back on to the default settings and rebooted to test what would happen with Task scheduler and I am not getting any alerts which is fine. Thanks again.

    Kind regards
    Chris
      My ComputerSystem Spec
  3.    08 Nov 2017 #13
    Join Date : Nov 2017
    Posts : 2
    Windows 10

    For running the program minimized using the cmd.exe /C start /MIN, the focus of the window still changes since the first cmd.exe is launched in a real window. You can avoid this by using the vbscript with WScript.exe:

    1. Create a .vbs script to the folder/name of your choice, I use startprocess.vbs in my example.
    Code:
    Option ExplicitDim oShell 'WScript.Shell objectDim iOption 'WScript.shell.run visibility option'For iOption, see https://technet.microsoft.com/en-us/library/ee156605.aspxSet oShell = CreateObject("WScript.Shell")If WScript.Arguments.Count >0 Then    If WScript.Arguments.Count > 1 then        iOption = CLng(WScript.Arguments.Item(1))        oShell.run WScript.arguments.item(0), iOption    Else        oShell.run WScript.arguments.item(0)    End IfEnd If
    2. Create launcher for the script to run your program
    wscript.exe /B /NoLogo [path]/startprocess.vbs "your command here with parameters" 7
    e.g. wscript.exe /B /NoLogo "C:\Windows\System32\cmd.exe /C MyStartup.cmd > C:\Temp\MyStartup.log" 7
    Now you can place the launcher to the Windows Task Scheduler (or any other place) and your command with parameters will be run minimized without changing the focus of the windows i.e. your work is not affected by the running process. This is due to the fact that wscript.exe does not create any windows when run with the batch mode with /B option.

    Script does not contain any error handling or other additional stuff.

    What the script does it uses the first argument (if it exist) as a full command line for launching the command and the second parameter as WShell.exec visibility option (Microsoft Windows 2000 Scripting Guide - Running Programs)

    When using with the Windows Task Schedule, you place
    C:\Windows\System32\wscript.exe
    as executable and the rest of the parameters as arguments, in my example
    /B /NoLogo "C:\Windows\System32\cmd.exe /C MyStartup.cmd > C:\Temp\MyStartup.log" 7
      My ComputerSystem Spec
  4.    09 Nov 2017 #14
    Join Date : Aug 2016
    Posts : 25
    Windows 10
    Thread Starter

    Thank you very much for this detailed explanation. Another solution Bree found was to add the argument "/background" in task scheduler.

    Kind regards
    Chris

    Click image for larger version. 

Name:	Desktop%20Secretary%20Task%20Scheduler.JPG 
Views:	6 
Size:	67.7 KB 
ID:	162975
      My ComputerSystem Spec
  5.    09 Nov 2017 #15
    Join Date : Nov 2017
    Posts : 2
    Windows 10

    There was a mistake in startup, the actual script was missing from command line:
    When using with the windows Tas Scheduler, you place
    C:\Windows\System32\wscript.exe
    as executable and the rest of the parameters as arguments, in my example
    /B /NoLogo path\startprocess.vbs "C:\Windows\System32\cmd.exe /C MyStartup.cmd" 7

    In the example I initially used the redirection of stdout to a log file (> C:\Temp\Mystartup.log) which is optional of course.

    Quote Originally Posted by mananas View Post
    When using with the Windows Task Schedule, you place
    C:\Windows\System32\wscript.exe
    as executable and the rest of the parameters as arguments, in my example
    /B /NoLogo "C:\Windows\System32\cmd.exe /C MyStartup.cmd > C:\Temp\MyStartup.log" 7
      My ComputerSystem Spec

 
Page 2 of 2 FirstFirst 12


Similar Threads
Thread Forum
Solved Start An EXE Minimized After Wake Up From Hibernate In Task Scheduler
Hello, I want to start an EXE program Minimized, or better yet, hidden (so I don't see its program in the Taskbar) only when the computer comes back from Hibernate. (This EXE file does the command to delete the hiberfil.sys file.) It only runs for a...
Software and Apps
Startup program starts minimized when in Tablet mode
Hi, I need Windows 10 to boot directly to a program. Whatever I try .vbs, .bat or just shortcut in Startup folder, it always starts minimized to task bar. When I click on the task bar it gets blown up full screen. Once I turn off the Tablet mode...
Software and Apps
Windows Arguments List - Start Programs Minimized with Task Scheduler.
Hello Community! I'm trying to get BBC iPlayer downloads to start automagically at 2100 so that it can start downloading Doctor Who. I'd like it to start minimized, but I am unsure how to do so. In addition to this, does anyone know if there...
Performance & Maintenance
Program wont start though its in system start up
I recently updated my 4 year old acer laptop to win10. I have a calender program called "windates" I placed a short cut in the system startup folder but the program does not start when I boot up my laptop. I did put a short cut on the desktop which...
General Support
Batch file - Unable to start a program minimized
I've been trying to figure this out for a while now and I can't. I've looked at tons of small tips online to get this working but it doesn't work at all. I have a batch file which causes various programs to start when opened. However, one of them...
General Support
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 14:05.
Find Us
Twitter Facebook Google+ Ten Forums iOS App Ten Forums Android App



Windows 10 Forums