Command line arguments: Difference between revisions

From MozillaZine Knowledge Base
Jump to navigationJump to search
(meh)
(fixed missing space before -migration)
(16 intermediate revisions by 9 users not shown)
Line 1: Line 1:
You can use ''command line arguments'' to start your Mozilla application with special behaviour.
You can use ''command line arguments'' to start your Mozilla application with special behavior.  


==How to use command line arguments==
==How to use command line arguments==
===For Windows users===
===For Windows users===
* Go to "Start -> Run" and enter the file path and file name of the application, followed by the command line arguments. For example,  
* Go to "Start -> Run" (On Windows 7/Vista, press "WindowsKey+R" or use the search box at the bottom of the Start menu) and enter the file path and file name of the application, followed by the command line arguments. For example,  
  "C:\Program Files\Mozilla Firefox\firefox.exe" -ProfileManager
  "C:\Program Files\Mozilla Firefox\firefox.exe" -ProfileManager
(including the quotation marks). In this example the file path to the [[installation directory]] is C:\Program Files\Mozilla Firefox, the file name of the Firefox application is firefox.exe, and the command line argument we are using is ProfileManager. You should place a hyphen (-) directly before each command line argument that you wish to use.
(including the quotation marks). In this example the file path to the [[installation directory]] is C:\Program Files\Mozilla Firefox, the file name of the Firefox application is firefox.exe, and the command line argument we are using is ProfileManager.
* If you regularly wish to start your application using command line arguments then you can also create a shortcut on your Desktop which includes them. To do this, right-click on an open space of the desktop and choose "New -> Shortcut". Follow the wizard to create the new shortcut. When it prompts you for location (not name), type the file path and file name followed by the command line arguments, exactly as in the example above.
* If you regularly wish to start your application using command line arguments then you can also create a shortcut on your Desktop which includes them. To do this, right-click on an open space of the desktop and choose "New -> Shortcut". Follow the wizard to create the new shortcut. When it prompts you for location (not name), type the file path and file name followed by the command line arguments, exactly as in the example above.


===For Linux and Mac OS X users===
===For Linux and Mac OS X users===
* Open a Terminal window and type what you want to execute.  On Linux, the shortcuts to your Terminal window will vary in location depending on your desktop environment.  On Mac OS X go to your Applications/Utilities folder and choose "Terminal".  Enter the path to the  application, then a space, followed by a hypen (-) and the command-line argument.  For example, to start the Firefox with the Profile Manager on Mac OS X,  you would enter the following:
* Open a Terminal window and type what you want to execute.  On Linux, the shortcuts to your Terminal window will vary in location depending on your desktop environment.  On Mac OS X go to your Applications/Utilities folder and choose "Terminal".  Enter the path to the  application, then a space, followed by the command-line argument.  For example, to start the Firefox with the Profile Manager on Mac OS X,  you would enter the following:
  /Applications/Firefox.app/Contents/MacOS/firefox -ProfileManager
  /Applications/Firefox.app/Contents/MacOS/firefox -ProfileManager
On some Mac versions (needs clarification), this command looks like
/Applications/Firefox.app/Contents/MacOS/firefox-bin -ProfileManager


==List of command line arguments (incomplete)==
==List of command line arguments (incomplete)==
Line 19: Line 21:
  ! Example
  ! Example
  |-
  |-
  | profile "<path>"
  | -profile "<path>"
  | Starts Firefox with profile located at the given path.
  | Starts with profile located at the given path.<br>''Does not apply to Mozilla Suite/SeaMonkey 1.x''
  | firefox.exe -profile "E:\myprofile"
  | firefox.exe -profile "E:\myprofile"
  |-  
  |-  
  | P "<profile name>"  
  | -P "<profile name>"  
  | Starts Firefox with a given profile name (profile name is case sensitive).
  | Starts with a given profile name (profile name is case sensitive).
  | firefox.exe -P "Joel User"
  | firefox.exe -P "Joel User"
  |-
  |-
  | <url>
  | <url>
  | Launches Firefox and opens the given URL(s).
  | Launches the application and opens the given URL(s).
  | firefox.exe <nowiki>"www.mozilla.org|www.mozillazine.org"</nowiki>
  | firefox.exe <nowiki>"www.mozilla.org" "www.mozillazine.org"</nowiki>
  |-
  |-
  | safe-mode
  | -safe-mode
  | Launches Firefox without loading extensions or themes.
  | Launches the application with extensions disabled and the default theme.<br>''Does not apply to Mozilla Suite/SeaMonkey 1.x''
  | firefox.exe -safe-mode
  | firefox.exe -safe-mode
  |-
  |-
  | height <value>
  | -no-remote
| Enables running [[Opening a new instance of your Mozilla application with another profile | multiple instances of the application with different profiles]];  [https://bugzilla.mozilla.org/show_bug.cgi?id=325509]  used with -P  <br>''Does not apply to Mozilla Suite/SeaMonkey 1.x''
| firefox.exe -no-remote
|-
| -height <value>
  | Sets height of the startup window to <value>.
  | Sets height of the startup window to <value>.
  | firefox.exe -height 600
  | firefox.exe -height 600
  |-
  |-
  | width <value>
  | -width <value>
  | Sets width of the startup window to <value>.
  | Sets width of the startup window to <value>.
  | firefox.exe -width 800
  | firefox.exe -width 800
  |-
  |-
  | ProfileManager
  | -ProfileManager
  | Starts with Profile Manager.
  | Starts with Profile Manager.
  | firefox.exe -ProfileManager
  | firefox.exe -ProfileManager
  |-
  |-
  | console
  | -CreateProfile
  | Starts Firefox with a debugging console.
| Create a new profile
| firefox -CreateProfile test
|-
| -migration
|Starts the application with the Import Wizard <br>''Does not apply to Mozilla Suite/SeaMonkey 1.x''
|firefox -migration
|- 
| -console
  | Starts the application with a debugging console.
  | firefox.exe -console
  | firefox.exe -console
  |-
  |-
  | jsconsole
  | -jsconsole
  | Starts with Javascript Console.
  | Starts with the Error Console (Javascript Console).
  | firefox.exe -jsconsole
  | firefox.exe -jsconsole
  |-
  |-
  | inspector <url>
  | -inspector <url>
  | Starts with the DOM Inspector.
  | Starts with the DOM Inspector.
  | firefox.exe -inspector http://www.google.com/
  | firefox.exe -inspector <nowiki>http://www.google.com/</nowiki>
  |-
  |-
  | chrome <url>
  | -chrome <url>
  | Loads the specified chrome.
  | Loads the specified chrome.
  | firefox.exe -chrome chrome://inspector/content/inspector.xul
  | firefox.exe -chrome chrome://inspector/content/inspector.xul
  |-
  |-
  | new-window <url>
  | -new-window <url>
  | Loads a URL in a new browser window.
  | Loads a URL in a new browser window.
  | firefox.exe -new-window <url>
  | firefox.exe -new-window <url>
  |-
  |-
  | new-tab <url>
  | -new-tab <url>
  | Loads a URL in a new tab.
  | Loads a URL in a new tab.
  | firefox.exe -new-tab <url>
  | firefox.exe -new-tab <url>
  |-
  |-
  | install-global-extension "<path>"
  | -install-global-extension "<path>"
  | Installs an extension globally.
  | Installs an extension globally.
  | firefox.exe -install-global-extension "C:\Temp\extension-file.xpi"
  | firefox.exe -install-global-extension "C:\Temp\extension-file.xpi"
|-
| -purgecaches
| Purges the caches for internal JavaScript and extensions.<br>''Applies since Firefox 4''
| firefox.exe -purgecaches
  |}
  |}


==See also==
==See also==
* [[Command line arguments (Thunderbird)]]
* [[Command line arguments - Thunderbird]]


==External links==
==External links==
* [http://www.mozilla.org/docs/command-line-args.html Mozilla Suite's command line options]: some of these apply to Firefox and Thunderbird too. The page being outdated, some command line options may not work.
* [http://developer.mozilla.org/En/Command_Line_Options Command Line Options - MDC]
* [http://www.mozilla.org/projects/firefox/extensions/commandlineoptions.html Extensions Manager's command line options]: applies to Firefox, Thunderbird, and other applications that use the Extension Manager code in those two programs. (Does not apply to the Mozilla Suite.)
* [http://www.mozilla.org/docs/command-line-args.html Mozilla's Command Line Options] (Mozilla Suite): Some of these apply to Firefox and Thunderbird too. The page being outdated, some command line options may not work.
 


[[Category:Configuration]]
[[Category:Configuration]]
[[Category:Firefox]]
[[Category:Startup - Firefox]]

Revision as of 18:52, 31 December 2016

You can use command line arguments to start your Mozilla application with special behavior.

How to use command line arguments

For Windows users

  • Go to "Start -> Run" (On Windows 7/Vista, press "WindowsKey+R" or use the search box at the bottom of the Start menu) and enter the file path and file name of the application, followed by the command line arguments. For example,
"C:\Program Files\Mozilla Firefox\firefox.exe" -ProfileManager

(including the quotation marks). In this example the file path to the installation directory is C:\Program Files\Mozilla Firefox, the file name of the Firefox application is firefox.exe, and the command line argument we are using is ProfileManager.

  • If you regularly wish to start your application using command line arguments then you can also create a shortcut on your Desktop which includes them. To do this, right-click on an open space of the desktop and choose "New -> Shortcut". Follow the wizard to create the new shortcut. When it prompts you for location (not name), type the file path and file name followed by the command line arguments, exactly as in the example above.

For Linux and Mac OS X users

  • Open a Terminal window and type what you want to execute. On Linux, the shortcuts to your Terminal window will vary in location depending on your desktop environment. On Mac OS X go to your Applications/Utilities folder and choose "Terminal". Enter the path to the application, then a space, followed by the command-line argument. For example, to start the Firefox with the Profile Manager on Mac OS X, you would enter the following:
/Applications/Firefox.app/Contents/MacOS/firefox -ProfileManager

On some Mac versions (needs clarification), this command looks like

/Applications/Firefox.app/Contents/MacOS/firefox-bin -ProfileManager

List of command line arguments (incomplete)

See also the external links at the bottom of this article.

Command Result Example
-profile "<path>" Starts with profile located at the given path.
Does not apply to Mozilla Suite/SeaMonkey 1.x
firefox.exe -profile "E:\myprofile"
-P "<profile name>" Starts with a given profile name (profile name is case sensitive). firefox.exe -P "Joel User"
<url> Launches the application and opens the given URL(s). firefox.exe "www.mozilla.org" "www.mozillazine.org"
-safe-mode Launches the application with extensions disabled and the default theme.
Does not apply to Mozilla Suite/SeaMonkey 1.x
firefox.exe -safe-mode
-no-remote Enables running multiple instances of the application with different profiles; [1] used with -P
Does not apply to Mozilla Suite/SeaMonkey 1.x
firefox.exe -no-remote
-height <value> Sets height of the startup window to <value>. firefox.exe -height 600
-width <value> Sets width of the startup window to <value>. firefox.exe -width 800
-ProfileManager Starts with Profile Manager. firefox.exe -ProfileManager
-CreateProfile Create a new profile firefox -CreateProfile test
-migration Starts the application with the Import Wizard
Does not apply to Mozilla Suite/SeaMonkey 1.x
firefox -migration
-console Starts the application with a debugging console. firefox.exe -console
-jsconsole Starts with the Error Console (Javascript Console). firefox.exe -jsconsole
-inspector <url> Starts with the DOM Inspector. firefox.exe -inspector http://www.google.com/
-chrome <url> Loads the specified chrome. firefox.exe -chrome chrome://inspector/content/inspector.xul
-new-window <url> Loads a URL in a new browser window. firefox.exe -new-window <url>
-new-tab <url> Loads a URL in a new tab. firefox.exe -new-tab <url>
-install-global-extension "<path>" Installs an extension globally. firefox.exe -install-global-extension "C:\Temp\extension-file.xpi"
-purgecaches Purges the caches for internal JavaScript and extensions.
Applies since Firefox 4
firefox.exe -purgecaches

See also

External links