Start Batch File Minimized via Task Scheduler

Page 1 of 3 123 LastLast

  1. Posts : 108
    Windows 7 and 10
       #1

    Start Batch File Minimized via Task Scheduler


    I have a batch file scheduled to run in Task Scheduler in Windows 10. The batch file runs on schedule, but it opens a full CMD window. I have tried entering variations on start /min in the Task Scheduler properties, but these seem to have no effect.

    The particular batch file opens and then pauses at a PAUSE statement, waiting for user response. I want it to start minimized partly because, when it opens to a full CMD window, it captures keystrokes, if I happen to be typing. In that case, the newly opened batch file blows past the pause and proceeds with its next steps. I don't want that to happen.

    Possibly I am using the wrong term. When I say "minimized," I mean that the batch file will be visible as an item on the taskbar, but its window will not open up onscreen. To access the batch file, I will have to coolswitch to it or click on its taskbar icon.

    So the question is, how can I start this batch file minimized, in the sense that it will open as a taskbar icon but not as a full CMD window?
      My Computer


  2. Posts : 5,328
    Windows 11 Pro 64-bit
       #2

    Have tried below command from Task Scheduler.


    Code:
    cmd.exe /k start /min myfile.bat
      My Computer


  3. Posts : 108
    Windows 7 and 10
    Thread Starter
       #3

    Thanks for taking a stab at it. But no, I can't seem to make that work in any combination. Most combinations (e.g., putting full path plus filename in the "Start in" field) run nothing. The most response I got was an error: "It appears as though arguments have been included in the Program text box." Do you have more specific knowledge as to which items should go in the Arguments and Start In fields?
      My Computer


  4. Posts : 5,328
    Windows 11 Pro 64-bit
       #4

    Let me test the command and i will let you now.
      My Computer


  5. Posts : 486
    Windows 10x64 17713
       #5

    Code:
    Set WshShell = WScript.CreateObject("WScript.Shell")obj = WshShell.Run("path to batch file.bat", 2)set WshShell = Nothing
    That will work in a .vbs file.
      My Computer


  6. Posts : 4,224
    Windows 10
       #6

    If this still comes up inoperable, you may want to try a third party tool. WinAutomation is very good, but I don't know if it will run minimized or not. A 2009 forum thread there discusses several ways to make it run minimized, but that's pretty old now. Check it out at WinAutomation - Smart Macro Recorder, Web Automation Recorder and more.
    HTH,
    --Ed--
      My Computers


  7. Posts : 5,328
    Windows 11 Pro 64-bit
       #7

    How about below script?


    Code:
    Echo @echo off > %tmp%\Test.bat
    
    Echo Echo testing >> %tmp%\Test.bat
    
    Echo pause >> %tmp%\Test.bat
    
    
    cmd.exe /c start /min %tmp%\Test.bat
    
    Exit
      My Computer


  8. Posts : 486
    Windows 10x64 17713
       #8

    Nircmd is another third party application that you can use to run it minimized.
      My Computer


  9. Posts : 2,799
    Linux Mint 20.1 Win10Prox64
       #9

    Create a shortcut of the bat file. Right click->Properties and set to rum minimize. Set the schedule to run the Shortcut instead.
      My Computer


  10. Posts : 16,932
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #10

    Use this procedure Make Windows 10 Task scheduler run a batch file minimised and with a specific icon - MSA Forum article

    I wrote that article but post any questions here not there as I do not contribute to that forum anymore.

    Denis
      My Computer


 

  Related Discussions
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 20:15.
Find Us




Windows 10 Forums