為了改善您的使用體驗,本網站正在進行維護,部分功能暫時無法使用。若本站的文件無法解決您的問題,想要向社群發問的話,請到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 發問,我們的社群成員將很快會回覆您的疑問。

搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

What is command line argument to raise and give focus to an existing instance of Firefox?

  • 5 回覆
  • 2 有這個問題
  • 1 次檢視
  • 最近回覆由 John99

more options

I'd like to create a shortcut which acts on the existing Firefox instance. If iconified, it should deiconify. In any case, it should come to the top of the window stack and take focus. I have looked over the command line arguments, and I don't see one that will do that. The closest I can come is to give it a URL; but I don't really want to open a new tab.

I'd like to create a shortcut which acts on the existing Firefox instance. If iconified, it should deiconify. In any case, it should come to the top of the window stack and take focus. I have looked over the command line arguments, and I don't see one that will do that. The closest I can come is to give it a URL; but I don't really want to open a new tab.

所有回覆 (5)

more options

There is an option to focus on a new window when it opens in the Firefox Options > tabs > "When I open a new tab switch to it immediately", however since you would like to do this from the command line/cmd the default ones are https://support.mozilla.org/en-US/kb/keyboard-shortcuts-perform-firefox-t...

If this does not already exist: https://developer.mozilla.org/en-US/d.../Commands

more options

The response from guigs2 was not helpful. Indeed, I don't think guigs2 understood my question. When Firefox is already running but iconified or buried under other windows, I want a simple way to deinconify it (if necessary), bring it to the front, and give its window focus. I figured there should be a command line argument that would do that; in which case I could put an invocation of Firefox with that argument into a system-level keyboard shortcut of the sort you can set up on any Windows shortcut. But I could not find such a command line argument. Referring me to the same list of command line arguments I have already examined certainly does not help. (If it is there is a disguised form, please tell me what it is explicitly.) The Firefox keyboard shortcuts are of no use unless the Firefox window already has focus; so those are clearly irrelevant.

If there is no way to do this with what exists in Firefox and Windows, I will just have to install AutoHotkey, as I know it can do what I want.

more options

Hi DrHow, currently I do not know of a command line argument that does this for Firefox at the moment. The last link shows an example of how to configure one. However if you are looking for one that is already developed, AutoHotkey may be a good work around.

more options

When I looked at the last link the first time, I could not even figure out what it had to do with my question. But I thought I would give it another try. I now realize that I had been dumped into the middle of the XUL tutorial. I knew nothing about XUL, but I began looking into it a bit. I am guessing that guigs2 is suggesting that I can compose a .xul file such that, if I invoked Firefox.exe passing it that file, then it would do what I want. However, looking around in the XUL Reference and XUL Controls, I have been unable to find anything that has to do with iconifying, deiconifying, raising to the top, or giving focus to a Firefox window. If such things are in there, I'd appreciate some pointers.

more options

This looks like a Windows question rather than a Firefox issue. I am not sure XUL will help but you will have already discovered the documentation starts here

Like you say Autohotkey may well be the answer. Autohotkey appears to automate exactly the kind of actions you are trying to use.

The program is written in Autohotkey with a single line of code:

^SPACE::  Winset, Alwaysontop, , A