batch-filefirefoxcmdwindows-10

Start Firefox Minimized From Batch File


I've made a batch file that starts Firefox.

The goal is to make Firefox to start minimized.

I've tried start /min "" "Path to Firefox.exe"

I've tried to create a Firefox shortcut with the option to minimize window.

However neither of these ways work on Firefox while they work on other programs even on the batch file itself.

Also -s and -silent flags do nothing on Firefox.

I'm using Windows 10.

Thank you for your help!


Solution

  • The way proposed by @SometimesRight didn't work.

    The solution is to install Minimize On Start And Close Firefox Add-On.

    Tested on Windows 10 and Firefox 43.0.4.

    At one time you could download it at https://addons.mozilla.org/en-US/firefox/addon/minimize-on-start-and-close/?src=api, but that link no longer works and the addon apparently no longer exists. Here is what the page looked like in 2018, courtesy of The Wayback Machine.

    Then in Firefox in the upper right menu (3 lines) choose Add-Ons and click on Extensions tab.

    Note: the first way below will always minimize Firefox when it starts and the BAT file that starts it. The second way require the creation of additional VBS script and it will minimize focused Firefox from minimized BAT file by sending ESCAPE keystroke.

    1. Click on the Options button and check Minimize on start, uncheck everything else and set Delay on start to 500 ms or higher if the Firefox needs more time to start.

    Now create file in Notepad and save it as Minimize.bat

    Copy and past the following code inside .BAT file:

    @echo off
    start "" "Path To Firefox"
    

    Change Path To Firefox to Firefox.exe location.

    You can also use "firefox.exe" instead of "Path To Firefox".

    If you want to start Firefox on specific website use start "" "Path To Firefox" www.stackoverflow.com

    Right-Click on Minimize.bat file and select Properties (also you can select Minimize.bat file and press ALT+ENTER combination).

    On Shortcut tab change Window property to Minimized and press OK.

    Start this shortcut.

    2. Click on the Options button and check Minimize on ESC-press, uncheck everything else.

    Create file in Notepad and save it as Minimize.vbs

    Copy and past the following code inside .VBS file:

    Set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.AppActivate "firefox"
    WshShell.SendKeys "{ESCAPE}"
    Set WshShell = Nothing
    

    Now create file in Notepad and save it as Minimize.bat

    Copy and past the following code inside .BAT file:

    @echo off
    start "" "Path To Firefox"
    timeout 2 /nobreak
    wscript "Path To Minimize.vbs File"
    

    Change Path To Firefox to firefox.exe location and Path To Minimize.vbs File to location of your Minimize.vbs file.

    You can also use "firefox.exe" instead of "Path To Firefox".

    If you want to start Firefox on specific website use start "" "Path To Firefox" www.stackoverflow.com

    You can change timeout 2 /nobreak to timeout 3 /nobreak to wait 3 seconds for Firefox to start if it starts longer.

    Right-Click on Minimize.bat file and select Properties (also you can select Minimize.bat file and press ALT+ENTER combination).

    On Shortcut tab change Window property to Minimized and press OK.

    Start this shortcut.