0

I created a bat file with the following code

"C:\Program Files\Internet Explorer\iexplore.exe" http://localhost:8083/

The bat file should run the link http://localhost:8083/ then I created a time scheduler on the server that run this bat file every 5 min so in theory the link should be called every 5 min

my problem is that the bat file is only being called once and I can't see that every 5 min a new instance of IE is called to run the webpage thus the code inside the weblink is not being executed every 5 min

what do you think i should do to fix this?

enter image description here

enter image description here

enter image description here

Sora
  • 2,465
  • 18
  • 73
  • 146
  • I think the explorer remains open. You can try [curl](https://stackoverflow.com/a/35491256/9925593) or powershell `Invoke-WebRequest`. – Pato Feb 22 '22 at 11:35
  • can you give me an example please? – Sora Feb 22 '22 at 12:30

1 Answers1

0

I think the problem is the task is never closed, so you need to change your bat file using another client to call your endpoint. For example, curl.

If you don't have curl follow this post

Here's an example that returns the server time:

ping.bat

@echo off
setlocal enabledelayedexpansion

(
  echo %date% %time%

  for /F %%x in ('curl http://localhost:3090/ping') do (
    echo %%~x
  )
)                                                                                                                               

Result:

C:\Users\Patricio>ping.bat
22/02/22 10:23:14,37
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    50  100    50    0     0     43      0  0:00:01  0:00:01 --:--:--    43
{"serverTime":"2022-02-22T10:23:15.5282576-03:00"}
Pato
  • 462
  • 2
  • 4
  • 11