37

I'm looking for a mechanism to open a single URL in the user's current default browser on a schedule/recurring basis.

I know that if I was writing .Net code to do this, I could simply do something along the lines of Process.Start("http://example.com/somePage.html") which will cause the default browser to open to that address. Likewise, I can go to Start -> Run and type in a given address and that too will cause the default browser to open to that address. Using this knowledge, I thought I would create a Windows Scheduled Task where the "Start a program" field was set to the URL I wanted to start. Unfortunately, this doesn't work. When the task runs, the URL is not opened (nor are any browsers).

Can anyone point me in the right direction to make this happen? Ideally, I would like to stay away from 3rd-party utilities, leveraging Windows' Task Scheduler would be great. Also, just to be clear, I'm not looking for a browser plugin to accomplish this.

Also, I'm not looking for anything fancy wrt waking a sleeping computer to carry this task out. I'm fine with just letting this happen only when a user is logged in.

fixer1234
  • 27,064
  • 61
  • 75
  • 116
ckittel
  • 598
  • 1
  • 5
  • 10

6 Answers6

37

I would create a batch file containing:

start http://example.com/somePage.html

And point Task Scheduler to that batch file. You can also test that it will work by running the batch file manually.

Windos
  • 11,061
  • 4
  • 38
  • 56
  • 4
    It may also work if you use that string as the command for your task, but I prefer to edit a batch file than have to look through my tasks if I need something changed. – Windos Aug 10 '11 at 04:38
  • Thanks @Windos, worked a treat. I found that it didn't work when that string was the command itself for my task. Could be that I was doing it wrong (missing "" around URL or something), but I didn't spent any extra time on it as the batch file solution gave me what I needed. – ckittel Aug 10 '11 at 13:51
  • The batch file approach works, but a black dos windows will flash. Is there any way to hide it? Using that string as the command of Task Scheduler doesn't work for me. – Gqqnbig Jul 06 '13 at 13:12
  • 1
    You will struggle with getting the batch file to actually get launched by Task Scheduler until you read this http://stackoverflow.com/questions/4437701/run-a-batch-file-with-windows-task-scheduler – Matthew Lock Sep 03 '16 at 09:44
  • just note that it will open a tab in your default browser, and after a while if you do not close them automatically or manually will degrade the performance of the system – Iman Nov 28 '16 at 13:59
  • It is not working for me.. might be something with Win 10 udpates.. it is asking to select the browser.. I have set Chrome as my default browser.. `cmd /c start http://stackoverflow.com/` is working for me.. thanks @julien – Sachin Sep 03 '20 at 07:49
  • can we call two webpages by single task scheduler? Basically I need to call 3 webpages and i don't want to create 3 diff schedulers for it. – lil-wolf Dec 24 '20 at 13:23
11

I've recently found myself trying to solve this exact issue and I have found a few things that can hopefully be of help.

Set up the scheduled task to run the following command:

explorer "http://example.com/somePage.html"

This does the trick without creating an extra file and without a flickering window. I have confirmed that this works on Windows 7 and opens the URL using the default browser.

The same trick however does NOT work in Windows XP. The same command in Windows XP will always use Internet Explorer to open the given URL. The best solution I have found for WIndows XP to date is to set up a scheduled task with

cmd /c start http://example.com/somePage.html

Again, no extra file required, but you do get a brief appearance of a command window.

I have not tested this on Windows Vista or Windows 8

3

You could make the Windows task manager run a program, and have it point to an HTML file that contains a redirection to the website you want it to open.

  1. Open Notepad.
  2. Write Javascript redirect.
  3. Save as HTML.
  4. Set task manager to open that HTML file on your desired schedule.

Here is the Javascript. Let me know if it works.

<script type="text/javascript">
window.location = "http://www.google.com/"
</script>
Wrzlprmft
  • 2,782
  • 5
  • 19
  • 31
Alex Waters
  • 1,496
  • 5
  • 16
  • 22
  • I have tested it, it works. – Alex Waters Aug 10 '11 at 04:50
  • 1
    +1. Thanks for this solution, I've tested it too, and it indeed works. @Windos solution is ideal for my needs, but I'm glad you posted this solution as it might be ideal for someone else. – ckittel Aug 10 '11 at 13:52
  • 1
    You mean "Task Scheduler->another program->my html->desired url"? Why don't the program directly open the desired url? – Gqqnbig Jul 06 '13 at 13:02
1

For some reason the above solutions weren't working for me on Windows Server 2008 so I ended up going with the vbs approach:

This has the added benefit of being able to do a POST with data if required.

Create a vbs file with the following contents:

Call LogEntry()

Sub LogEntry()

'Force the script to finish on an error.
On Error Resume Next

'Declare variables
Dim objRequest
Dim URL

'The URL link.
URL = "https://www.example.com"

Set objRequest = CreateObject("Microsoft.XMLHTTP")

'Open the HTTP request and pass the URL to the objRequest object
objRequest.open "GET", URL , false

'Send the HTML Request
objRequest.Send

'Set the object to nothing
Set objRequest = Nothing

End Sub

Credit to this site

Matt Kemp
  • 111
  • 3
  • should this example be credited to http://www.642weather.com/weather/wxblog/php-scripts/scheduled-http-request-windows-task-scheduler/ – Binarysurf Aug 27 '16 at 01:05
0

There are programs like One Million Clicks that can refresh a web page every x seconds/min/hours. You can even use a list of proxies to simulate real visitors on that page.

Gabriel
  • 2,059
  • 7
  • 32
  • 49
0

If the reason that you're opening the webpage is that you need to keep an IIS application pool or worker process alive you can use a tool called Application Pool Defibrillator.

Kristoffer
  • 290
  • 1
  • 2
  • 10
  • Or (in IIS 8.5 and above) you could set the app pool to be suspended rather than terminated, or set a longer timeout - see: https://docs.microsoft.com/en-us/iis/get-started/whats-new-in-iis-85/idle-worker-process-page-out-in-iis85 – AndyS Jun 29 '18 at 12:36