运行批处理脚本以在PC启动时在一个窗口中运行网页

时间:2022-05-17 02:12:47

I have a batch script that I start with task scheduler on computer start. I need after running this script to show up some web pages that I don't have to do it again and again after every pc-start. But problem is that my script:

我有一个批处理脚本,我从计算机启动时的任务调度程序开始。我需要在运行此脚本后显示一些网页,我不必在每次启动电脑后一次又一次地执行此操作。但问题是我的脚本:

start "" http://*.com/users/6637228/marek-bern%c3%a1d
start "" https://www.facebook.com/
start "" https://www.youtube.com/feed/history

Is naturally opening these links as three new browser windows, but I need all them to be tabs. Ok I was looking for solution but still did't found much.

自然是将这些链接打开为三个新的浏览器窗口,但我需要它们都是标签。好的我正在寻找解决方案,但仍然没有找到太多。

But I found one great video that helped me push this problem further: https://www.youtube.com/watch?v=Rcwz9CM9I_E

但我发现了一个很棒的视频,帮助我进一步解决了这个问题:https://www.youtube.com/watch?v = RMwz9CM9I_E

Where that guy have a script like:

那家伙有一个像这样的脚本:

@ECHO OFF
SET BROWSER=firefox.exe
SET WAIT_TIME=2
START %BROWSER% -new-tab ""
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% -new-tab ""
START %BROWSER% -new-tab ""

I know about this idea, but I have still problem with this. Browser will start web pages in one window but:

我知道这个想法,但我仍然有这个问题。浏览器将在一个窗口中启动网页,但:

  • There is still problem that one page is in new second window, don't know why
  • 还有一个页面在新的第二个窗口中的问题,不知道为什么

  • I have there generated new empty tab that I won't
  • 我在那里生成了新的空标签,我不会

I am telling about this trying(I tried to get more time for example but not working well and much more combinations like this):

我告诉我这个尝试(我试图获得更多时间,但不能很好地工作,还有更多像这样的组合):

@ECHO OFF
SET BROWSER=firefox.exe
SET WAIT_TIME=4

@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul

START "" http://*.com/users/6637228/marek-bern%c3%a1d
START %BROWSER% -new-tab "" https://www.facebook.com/
START %BROWSER% -new-tab "" https://www.youtube.com/feed/history

Could someone please explain me how to do it programmatically and why it works so?

有人可以解释一下如何以编程方式进行操作以及为什么这样做?

2 个解决方案

#1


1  

Assuming you want to use the command line,

假设您要使用命令行,

According to https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options#Browser , Firefox accepts multiple urls to be opened together.

根据https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options#Browser,Firefox接受多个网址一起打开。

So the command would look like this:

所以命令看起来像这样:

START firefox.exe http://*.com/users/6637228/marek-bern%c3%a1d  https://www.facebook.com/ https://www.youtube.com/feed/history

#2


1  

Would it not just be a lot easier to manually set the home pages to open directly in Firefox so they open in individual tabs, and then just have a scheduled task to launch Firefox rather than a batch file? That way, a single browser instance will just open when you log in and all your homepages will automatically appear in separate tabs. Plus it will be far easier to add new tabs in the future:

手动将主页设置为直接在Firefox中打开以便它们在单个选项卡中打开,然后只是有一个计划任务来启动Firefox而不是批处理文件,这不是更容易吗?这样,当您登录时,只会打开一个浏览器实例,并且所有主页将自动显示在单独的选项卡中。此外,将来添加新标签会更容易:

运行批处理脚本以在PC启动时在一个窗口中运行网页

运行批处理脚本以在PC启动时在一个窗口中运行网页

#1


1  

Assuming you want to use the command line,

假设您要使用命令行,

According to https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options#Browser , Firefox accepts multiple urls to be opened together.

根据https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options#Browser,Firefox接受多个网址一起打开。

So the command would look like this:

所以命令看起来像这样:

START firefox.exe http://*.com/users/6637228/marek-bern%c3%a1d  https://www.facebook.com/ https://www.youtube.com/feed/history

#2


1  

Would it not just be a lot easier to manually set the home pages to open directly in Firefox so they open in individual tabs, and then just have a scheduled task to launch Firefox rather than a batch file? That way, a single browser instance will just open when you log in and all your homepages will automatically appear in separate tabs. Plus it will be far easier to add new tabs in the future:

手动将主页设置为直接在Firefox中打开以便它们在单个选项卡中打开,然后只是有一个计划任务来启动Firefox而不是批处理文件,这不是更容易吗?这样,当您登录时,只会打开一个浏览器实例,并且所有主页将自动显示在单独的选项卡中。此外,将来添加新标签会更容易:

运行批处理脚本以在PC启动时在一个窗口中运行网页

运行批处理脚本以在PC启动时在一个窗口中运行网页