4

At a certain time each day, I'd like my browser to pop open a tab to a certain URL.

My goals:

  1. be able to set the URL from the scheduled task
  2. use the default browser (rather than hard-coding it)

I can't seem to accomplish both of these goals at once. I'll post my partial solutions as answers, but I'm hoping someone will have something better.

5 Answers 5

8

Note that this command will open the default browser (or a new tab therein) to the given url:

cmd /c start http://example.com

To create a scheduled task without the command window popping up:

Create OpenUrl.vbs:

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

Then call it from a scheduled task with this command:

wscript.exe "C:\Path\To\Script\OpenUrl.vbs" http://example.com
4
  • Thanks. I added my notes to the answer. Commented Apr 19, 2010 at 14:17
  • @JeremyStein You could remove your notes here because they are already written on your alternative answer, which seems more clean. Thanks ;)
    – bluish
    Commented Mar 11, 2015 at 13:02
  • @bluish, I though dmb deserved the Accepted Answer. I've edited it to be a clean single answer. Commented Mar 11, 2015 at 17:48
  • @JeremyStein mhm, I would reward him with an upvote, but if the favorite solution is another it should be posted as a different answer and accepted. It's just my opinion.. :)
    – bluish
    Commented Mar 12, 2015 at 7:58
2

This solution is hard-coded to Firefox:

Create the scheduled task with this URL:

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

Well, you could just create the 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
  • I always assumed those were binary files. I never thought to inspect their contents. Thanks! Commented Apr 19, 2010 at 20:23
0

This solution doesn't 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 the scheduled task to run the .vbs script.

0

One additional thing to note for the FF solution - if your URL has ampersands in it - you may need to escape those in Scheduled tasks using the caret ^& character.

Oops - this is wrong. The ^ was needed to escape the Ampersand when testing the link in a CMD window - but is okay in the actual Scheduled Task.

Not the answer you're looking for? Browse other questions tagged or ask your own question.