最重要的 Firefox 命令行选项
FIrefox
![](/data/attachment/album/201801/23/234142oi23zlyukzxej22z.jpg)


Firefox web 浏览器支持很多命令行选项，可以定制它启动的方式。


你可能已经接触过一些了，比如 `-P "配置文件名"` 指定浏览器启动加载时的配置文件，`-private` 开启一个私有会话。


本指南会列出对 FIrefox 来说比较重要的那些命令行选项。它并不包含所有的可选项，因为很多选项只用于特定的目的，对一般用户来说没什么价值。


你可以在 Firefox 开发者网站上看到[完整](https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options) 的命令行选项列表。需要注意的是，很多命令行选项对其它基于 Mozilla 的产品一样有效，甚至对某些第三方的程序也有效。


### 重要的 Firefox 命令行选项


![firefox command line](/data/attachment/album/201801/23/234211r6dajkmar5ia1dm6.png)


#### 配置文件相关选项


* `-CreateProfile 配置文件名` -- 创建新的用户配置信息，但并不立即使用它。
* `-CreateProfile "配置文件名 存放配置文件的目录"` -- 跟上面一样，只是指定了存放配置文件的目录。
* `-ProfileManager`，或 `-P` -- 打开内置的配置文件管理器。
* `-P "配置文件名"` -- 使用指定的配置文件启动 Firefox。若指定的配置文件不存在则会打开配置文件管理器。只有在没有其他 Firefox 实例运行时才有用。
* `-no-remote` -- 与 `-P` 连用来创建新的浏览器实例。它允许你在同一时间运行多个配置文件。


#### 浏览器相关选项


* `-headless` -- 以无头模式（LCTT 译注：无显示界面）启动 Firefox。Linux 上需要 Firefox 55 才支持，Windows 和 Mac OS X 上需要 Firefox 56 才支持。
* `-new-tab URL` -- 在 Firefox 的新标签页中加载指定 URL。
* `-new-window URL` -- 在 Firefox 的新窗口中加载指定 URL。
* `-private` -- 以隐私浏览模式启动 Firefox。可以用来让 Firefox 始终运行在隐私浏览模式下。
* `-private-window` -- 打开一个隐私窗口。
* `-private-window URL` -- 在新的隐私窗口中打开 URL。若已经打开了一个隐私浏览窗口，则在那个窗口中打开 URL。
* `-search 单词` -- 使用 FIrefox 默认的搜索引擎进行搜索。
* - `url URL` -- 在新的标签页或窗口中加载 URL。可以省略这里的 `-url`，而且支持打开多个 URL，每个 URL 之间用空格分离。


#### 其他选项


* `-safe-mode` -- 在安全模式下启动 Firefox。在启动 Firefox 时一直按住 Shift 键也能进入安全模式。
* `-devtools` -- 启动 Firefox，同时加载并打开开发者工具。
* `-inspector URL` -- 使用 DOM Inspector 查看指定的 URL
* `-jsconsole` -- 启动 Firefox，同时打开浏览器终端。
* `-tray` -- 启动 Firefox，但保持最小化。


 




---


via: <https://www.ghacks.net/2017/10/08/the-most-important-firefox-command-line-options/>


作者：[Martin Brinkmann](https://www.ghacks.net/author/martin/) 译者：[lujun9972](https://github.com/lujun9972) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
# The most important Firefox command line options

![firefox command line](https://www.ghacks.net/wp-content/uploads/2017/10/firefox-command-line.png)

The Firefox web browser supports a number of command line options that it can be run with to customize startup of the web browser.

You may have come upon some of them in the past, for instance the command -P "profile name" to start the browser with the specified profile, or -private to start a new private browsing session.

The following guide lists important command line options for Firefox. It is not a complete list of all available options, as many are used only for specific purposes that have little to no value to users of the browser.

You find the [complete](https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options) listing of command line options on the Firefox Developer website. Note that many of the command line options work in other Mozilla-based products, even third-party programs, as well.

## Important Firefox command line options



**Profile specific options**

**-CreateProfile profile name**-- This creates a new user profile, but won't start it right away.**-CreateProfile "profile name profile dir"**-- Same as above, but will specify a custom profile directory on top of that.**-ProfileManager**, or**-P**-- Opens the built-in profile manager.- -
**P "profile name"**-- Starts Firefox with the specified profile. Profile manager is opened if the specified profile does not exist. Works only if no other instance of Firefox is running. **-no-remote**-- Add this to the -P commands to create a new instance of the browser. This lets you run multiple profiles at the same time.

**Browser specific options**

**-headless**-- Start Firefox in headless mode. Requires Firefox 55 on Linux, Firefox 56 on Windows and Mac OS X.**-new-tab URL**-- loads the specified URL in a new tab in Firefox.**-new-window URL**-- loads the specified URL in a new Firefox window.**-private**-- Launches Firefox in private browsing mode. Can be used to run Firefox in private browsing mode all the time.**-private-window**-- Open a private window.**-private-window URL**-- Open the URL in a new private window. If a private browsing window is open already, open the URL in that window instead.**-search term**-- Run the search using the default Firefox search engine.- -
**url URL**-- Load the URL in a new tab or window. Can be run without -url, and multiple URLs separated by space can be opened using the command.

Other options

**-safe-mode**-- Starts Firefox in Safe Mode.Â You may also hold down the Shift-key while opening Firefox to start the browser in Safe Mode.**-devtools**-- Start Firefox with Developer Tools loaded and open.**-inspector URL**-- Inspect the specified address in the DOM Inspector.**-jsconsole**-- Start Firefox with the Browser Console.**-tray**-- Start Firefox minimized.

![The most important Firefox command line options](https://www.ghacks.net/wp-content/uploads/2017/10/firefox-command-line.png)

![Ghacks Technology News](https://www.ghacks.net/wp-content/uploads/2005/10/ghacks-technology-news.jpg)

daneyul ebsaid on June 24, 2022 at 5:14 pm–tray or -tray does not open it minimized.

Tom Hawacksaid on June 24, 2022 at 7:45 pm@daneyul eb, the article is dated 2017/10, some things have changed since.

You can check Firefox/CommandLineOptions – MozillaWiki at [https://wiki.mozilla.org/Firefox/CommandLineOptions]

Joesaid on November 6, 2020 at 5:14 pm-kiosk is another i don’t see there (i might be blind) puts it in kiosk mode (duh) at lauch.

combined with -url very useful

Behealthissaid on March 18, 2020 at 10:45 pmCortana and Search go separate ways. You find a search bar and a Cortana button on the Windows taskbar in the new Windows 10 release.

Maheshsaid on March 14, 2018 at 7:36 amWith the latest update, “-private-window URL” stated having a weird behavior. It opens the page in the private window but opens a non private empty window as well!

sludge7051-xsaid on January 28, 2018 at 1:35 am. . . I got lots of help with it, getting my questions answered, I just combined it into something useful.

. . . If I know someone likes it, and finds it useful, that’s worth a lot more to me, thanks!

If you look at the top of the “Instructions” tab, I see that I started experimenting with how to do this 12/30/09 . . . so, it’s taken me 9 years to get it to this point.

. . . But, I had this big breakthrough in automation only recently, after FF57 came out (11/14/17), and SQLite Manager no longer worked.

Yes, please let me know how it works for you, or if I can answer any questions.

sludge7051-xsaid on January 8, 2018 at 9:30 pmHere’s what I figured out. There’s too much to put here, so, I’ve put it on a 4-page PDF on my Google Docs:

4 Ways to get to Firefox “Other Bookmarks”, from slowest to fastest

The following are 4 macros that I have in Excel 2010.

The first two just use VBA.

The second two use NirCmd.

https://drive.google.com/open?id=1eche0L-qHRWVA_yEh0JiL1k5SNK4HpCt

v00psaid on January 23, 2018 at 10:10 pmThanks sludge7051-x for those VBS x Nircmd alternatives.

I’m trying to launch my FF’s bookmark library at a specific location (bookmark’s folder)…

Unlike Google Chrome’s bookmark manager, which assign an unique URL for each bookmark folder created, FF provide literrally no way to use it’s bookmark manager (library) efficiently.. Would you think of any possible way we could use nircmd to point to any one of those from the command line ?

sludge7051-xsaid on January 26, 2018 at 11:51 pmI just posted this (I thought it could be useful to others). My solution is to just get all the bookmarks into Excel, and then work with them there:

Firefox Bookmarks to .xlsm [SOLVED] . . . https://www.mrexcel.com/forum/excel-questions/1040778-firefox-bookmarks-xlsm-solved.html#post4995974

v00psaid on January 27, 2018 at 9:54 pm@sludge7051-x, That my friend, is awesome. Have you made this in 6 days only ?

I haven’t actually tried it yet, but I’v read that first post describing what and how it does..

Trying it right now. This is some great exemple of the power of sharing & caring.. I totally appreciate (and admire this) … if you’ve got some crypto wallet pub key to provide, please put it somewhere in a signature, or pm me. I’d gladly donate for such a selfless & caring share.

Will provide input on my experience with it.

sludge7051-xsaid on December 19, 2017 at 5:20 pmI want to make a macro in Excel 2010 that goes to “Other Bookmarks” . . . I can’t figure out how to do it

The closest I can get is, I open this, and it default opens to “All Bookmarks” . . . this is a “skin”

“C:\Program Files (x86)\Mozilla Firefox\firefox.exe” -chrome chrome://browser/content/places/places.xul

But, what I want is, and can only be done from within Firefox – I use this Keyboard Shortcut, and it default opens to “Other Bookmarks”

Ctrl + Shift + B

What I’ve tried:

1.) VBA “Call Send Keys” from Excel 2010 does not act on Firefox

2.) AutoHotKey is not able to communicate with Firefox: open FF, then input ^+b

Is there an easy “switch” I can just add to the Shortcut “-chrome”?

Or, is there a Firefox CLI, that I can use in a BAT file, and have another text file “act on” it, to open to “Other Bookmarks”? Any idea where the commands to do so are provided?

A different Martinsaid on October 10, 2017 at 1:22 amThanks, Martin — this is useful info to squirrel away for future reference, and because it’s limited to Firefox, it’s easier to read than Mozilla’s page.

For what it’s worth, it doesn’t seem to matter whether the profile switch is uppercase (-P) or lowercase (-p),

at least in Windows.I accidentally used a lowercase switch in my Firefox shortcuts and my two Firefox installs open with their correct respective profiles regardless. I vaguely remember that Linux is strictly case-sensitive when it comes to command-line entries. I have no idea whether OSX is, but since OSX is based on BSD, I’m guessing it might be as well. Best to play it safe and stick with an uppercase -P. You donotwant to accidentally open a carefully curated pre-55 profile in a 55+ Firefox, or vice versa. (I know, because I’ve done it. Thankfully, I had recent backup profiles on hand.)lehnerus2000said on October 9, 2017 at 11:52 amWill these still be available once FF57 arrives?

Martin Brinkmannsaid on October 9, 2017 at 12:38 pmYes they will.

lehnerus2000said on October 10, 2017 at 5:04 pmThank you Martin. :)

dmacleosaid on October 8, 2017 at 8:55 pmor point shortcut to waterfox exe….

Rick A.said on October 8, 2017 at 12:53 pmMartin, Soren, Pants, Chef-Koch, anybody, what’s going on with Dash in Firefox / YouTube? it doesn’t fully buffer the video anymore or do anything regardless if i have media.mediasource.enabled set to true or false and if i right click on YouTube’s video player and left click on “Stats For Nerds” which looks totally different now, Dash is no longer listed. Can anybody tell me anything please? is there a new preference that will handle anything like this which i doubt? is there anyway to get the video to fully buffer again? is Scroogle just throttling the download speeds on YouTube now so Dash is irrelevant ?

Martin’s article on Dash https://www.ghacks.net/2016/08/31/how-to-enforce-full-video-buffering-on-youtube/ and an add-on i was using to give me a toggle button so i could quickly toggle media.mediasource.enabled without having to go to about:config every time https://addons.mozilla.org/en-US/firefox/addon/youtube-without-dash-playback/ which i guess is now abandoned because the developer will not respond if he plans on making it a web extension or not, if he even can make it a web extension. i’m sure someone here, maybe one of the people i mentioned at the beginning of this comment will know if it could be made a web extension or not, i would think that it could.

Anonymoussaid on October 8, 2017 at 6:02 pm> YouTube doesn’t fully buffer the video anymore or do anything regardless if i have media.mediasource.enabled set to true or false

Yes, it’s the new version of YouTube, they must have done something to prevent full buffer, but it’s possible that some add-ons can fix it for you. I didn’t look into the change at all, just confirmed that even with MediaSource disabled YouTube still doesn’t buffer the whole video, so I don’t know which web standard they use to achieve that, could be just regular JS, in which case a solution may be to use a NoScript surrogate or some Grease/Violentmonkey script. But there may exist specific add-ons whose only purpose is to fully buffer YouTube videos, the question being are they updated to work with the new YouTube player yet.

Helpful-readersaid on October 8, 2017 at 7:57 amOn Mac you can bring up Firefoxe’s Profile Manager by holding down the option (alt) key while launching FF.

amssaid on October 8, 2017 at 7:45 am“safe mode” is oxymoronic here, isn’t it? It means you’ll be launching your browser bare naked, without the benefit of any extensions (inclusive of adblocking and privacy addons).

from support.mozilla.org/en-US/kb/troubleshoot-firefox-issues-using-safe-mode

“Safe Mode is a special Firefox mode that can be used to troubleshoot and fix problems. Safe Mode temporarily turns off hardware acceleration, resets some settings, and disables add-ons”

from kb.mozillazine.org/Safe_mode

==========

Safe Mode is a debugging startup mode available in Firefox, Thunderbird, and SeaMonkey 2, where all added extensions are disabled, the default theme is used, and default localstore settings (toolbar settings and controls) are used. Safe Mode also disables hardware acceleration, the Just-in-time (JIT) JavaScript compiler, and any changes made via userContent.css and userChrome.css. Any changes made to preference settings remain in effect in Safe Mode, however, and all available plugins are used. To summarize:

Safe Mode temporarily affects the following:

All extensions are disabled.

The default theme is used, without a persona.

The Just-in-time (JIT) JavaScript compiler is disabled.

The userChrome.css and userContent.css files are ignored.

The default toolbar layout is used.

Hardware acceleration is disabled.

Safe Mode has no effect on the following:

The status of plugins is not affected.

Custom preferences are not affected.

==========

After reading “all that”, I still honestly don’t know whether SafeMode flat-out disables javascript execution

(and, looking forward, wonder whether SafeMode suppresses asm.js execution)

riri0said on October 9, 2017 at 6:16 amI am very sure you are trying your hardest to not be a troll, but sure, enjoy urself trying hard to troll at the same time.