2

I have multiple instances of TorBrowser browser set up, in their own folders.

They maintain their own configs, guard node, etc. Sometimes I accidentally open a second instance. It works, but uses the existing tor.exe, and you don't have the tor circuit button to the left of the URL.

I want to block multiple instances from opening. With Firefox Portable, you just set AllowMultipleInstances=false in FirefoxPortable.ini. There are no .ini files in the TorBrowser directory structure containing "multiple" and I also checked about:config for "multiple."

(TorBrowser is built from Firefox Portable, and it uses Firefox extensions.)

2 Answers 2

5

This does what I want. If tor.exe is running, TorBrowser won't start, and the command window stays open with the message. Otherwise TorBrowser starts and the command window closes. This also allows a regular Firefox browser session to be running at the same time.

@echo off
tasklist | find /i "tor.exe" > nul
if %errorlevel% equ 0 goto running
"C:\ [TorBrowser path] \Browser\firefox.exe"
exit    
:running
echo "Another TorBrowser is already running. (tor.exe is running.)"
@pause
0
4

You don't mention OS, but for Windows, the following batch file makes Firefox single instance. Start the browser using a shortcut to the batch file, rather than directly. You might adapt it for Tor.

@echo off
tasklist | findstr "firefox.exe"
if %errorlevel% equ 0 goto running
if %errorlevel% equ 1 start " " "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
exit    
:running
"C:\Program Files (x86)\NirSoft\NirCmd\nircmd" win activate process firefox.exe 
exit

Notes

  • Nirsoft's NirCmd is only used to focus a running instance of Firefox. Omit if you prefer to raise the window manually.
  • Untested for other applications.
1
  • For some reason this doesn't work for me (your tasklist / errorlevel part). In my answer, I just search for tor.exe, and if it's not found I start TorBrowswer. This also avoids a problem if I have a regular firefox browser open. I want to be able to run them at the same time.
    – Kyle
    Commented Jan 24 at 0:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .