Reputation: 103
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!
Upvotes: 2
Views: 7647
Reputation: 1
Well, I have tried the method proposed by @samuel, but it did not work in my windows 11. My solution is not to install any add-ons, but rather in conjunction with another thread: link
Instead the content of Minimize.vbs in this thread, you can put this:
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.AppActivate "firefox"
WshShell.SendKeys "%{ }"
WshShell.SendKeys "n"
Set WshShell = Nothing
Besides, you don`t need to set any special propierties in the .bat file.
Upvotes: 0
Reputation: 103
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.
You can download it here: https://addons.mozilla.org/en-US/firefox/addon/minimize-on-start-and-close/?src=api
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.
Upvotes: 1
Reputation: 659
I expect Firefox automatically restores itself on startup. You could try using the -tray option to firefox:
start "" "Path to firefox" -tray
EDIT: the generic Mozilla option '-tray' does not seem to be supported for Firefox. However, the /min option to 'start' does work (for me!) on Windows 10 as long as there is no other instance of Firefox already running. If another instance is running its window will restore itself in the foreground when you run another start command even if you use /min.
If you want to start a second or subsequent instance minimized use Firefox's -new-window option:
start /min "" "Path to firefox" -new-window
Upvotes: 1