Reputation: 19661
At a certain time each day, I'd like my browser to pop open a tab to a certain URL.
My goals:
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.
Upvotes: 4
Views: 10046
Reputation: 603
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
Upvotes: 8
Reputation:
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.
Upvotes: 0
Reputation: 2286
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
Upvotes: 1
Reputation: 19661
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
Upvotes: 2
Reputation: 19661
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.
Upvotes: 0