Windows 10 reached EOS (end of support) on October 14, 2025. If you are on Windows 10, see this article.

Tìm kiếm hỗ trợ

Tránh các lừa đảo về hỗ trợ. Chúng tôi sẽ không bao giờ yêu cầu bạn gọi hoặc nhắn tin đến số điện thoại hoặc chia sẻ thông tin cá nhân. Vui lòng báo cáo hoạt động đáng ngờ bằng cách sử dụng tùy chọn "Báo cáo lạm dụng".

Tìm hiểu thêm
Đã giải quyết

open a url in cmdfile in private window

Denys đã trả lời
LudwigWN

I have a cmdfile to open specific news websites in a private window. The syntax of the cmdfile line is

start "" "C:\Program Files\Mozilla Firefox\firefox.exe" -private-window %*

with a "timeout /t 2 /nobreak" call for a 2 secs pause between each to give things time to get going (firefox seems to trip up if I rush it with URLs using start command .. probably understandable).

This works, but all "windows" open in a new tab in the existing or initial private window instance. I want them to each open in their own instance of a private window. It seems to be behaving like the option -new-tab rather than a genuine new private window for each URL.

What option/s do I need to use to get a true new private window with just the specified URL open in a single tab for each URL I have coded?

I have a cmdfile to open specific news websites in a private window. The syntax of the cmdfile line is start "" "C:\Program Files\Mozilla Firefox\firefox.exe" -private-window %* with a "timeout /t 2 /nobreak" call for a 2 secs pause between each to give things time to get going (firefox seems to trip up if I rush it with URLs using start command .. probably understandable). This works, but all "windows" open in a new tab in the existing or initial private window instance. I want them to each open in their own instance of a private window. It seems to be behaving like the option '''-new-tab''' rather than a genuine new private window for each URL. What option/s do I need to use to get a true new private window with just the specified URL open in a single tab for each URL I have coded?

Tất cả các câu trả lời (3)

Giải pháp được chọn

Hi,

What you describe matches https://wiki.mozilla.org/Firefox/CommandLineOptions#-private-window_URL

One workaround may be running two commands instead of one every time:

  • start "" "C:\Program Files\Mozilla Firefox\firefox.exe" -private-window
  • start "" "C:\Program Files\Mozilla Firefox\firefox.exe" -private-window %*

This will open a new private window first, and then a new tab in that window (since it will be the last active one). The only potential disadvantage is New Tab as the first tab of every window, but this doesn't seem to be that bad...

Does the above work for you?

If I don't do the "timeout /t 2" between each start statement, it can trip up and produce odd results especially for the first URL ie first opening of firefox private window. Even a 1 sec timeout is not reliable, needs to be 2 secs.

And I do get a "New tab" as well but can live with that. Hopefully firefox can have switches that will do it more logically eg

  • -PRIVATE-WINDOW opens the URL in a new instance of the program ie a new 'window'
  • -PRIVATE-TAB opens the URL in a new tab in the current private window instance

Otherwise - yes it works! Thanks.

Được chỉnh sửa bởi LudwigWN vào

It's unlikely to be prioritized, but feel free to file an enhancement requst on Bugzilla.

Đặt một câu hỏi

Bạn phải đăng nhập vào tài khoản của bạn để trả lời bài viết. Vui lòng bắt đầu một câu hỏi mới, nếu bạn chưa có tài khoản.