Scheduled task to open URL

At a specific time every day, I want my browser to open a tab for a specific URL.

My goals:

  • be able to set a URL from a scheduled task
  • use the default browser (rather than hard coding it)

It seems I can not complete both of these posts at once. I will post my partial solutions as answers, but I hope someone will have something better.

+4
source share
5 answers

Please note that this command will open the default browser (or a new tab in it) for this URL:

cmd /c start http://example.com 

To create a scheduled task without a command popup:

Create OpenUrl.vbs:

 CreateObject("Wscript.Shell").Run "cmd /c start " & Wscript.Arguments.Item(0), 0, False 

Then call it from the scheduled task with this command:

  wscript.exe "C: \ Path \ To \ Script \ OpenUrl.vbs" http://example.com 
+8
source

This solution is hard-coded for Firefox:

Create a scheduled task with this URL:

  "C: \ Program Files \ Mozilla Firefox \ firefox.exe" -new-tab http://example.com 
+2
source

Well, you can just create a url file from your script:

 Dim fso, MyFile Set fso = CreateObject("Scripting.FileSystemObject") Set MyFile= fso.CreateTextFile("c:\example.url", True) MyFile.WriteLine("[InternetShortcut]") MyFile.WriteLine("URL=http://stackoverflow.com/questions/2655253/scheduled-task-to-open-url") MyFile.Close 
+1
source

This solution does not allow me to set the URL from the scheduled task:

Create a .url file pointing to the URL I want.

Create a .vbs script that opens the url:

 CreateObject("Wscript.Shell").Run """example.url""", 0, False 

Create a scheduled task to run the .vbs script.

0
source

Another note for solving FF - if your URL has ampersands in it - you may need to avoid those that are performed in Scheduled tasks using the caret ^ & character function.

Oops - this is wrong. "^" It was necessary to avoid Empersand when testing the link in the CMD window, but in a real scheduled task this is normal.

0
source

Source: https://habr.com/ru/post/1307173/


All Articles