In a Batch script how to refresh webpage after launching in default browser

I want to refresh the launched webpage just 3 times in an interval of 7 seconds after webpage is launched by the below script. How can I do that? ( This refresh is required for the application to load properly)

@echo Launching application in webpage
start http://localhost:%NewPort%/MyProject
Aryabhatta MAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
You would have to use tools to do that with a batch file. However, PowerShell can get control over a web pages it starts.
Bill PrewIT / Software Engineering ConsultantCommented:
And you could run a VBscript from the BAT file to do the load of the web page and refreshes, but that isn't much different than the Powershell approach mentioned above...

Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
PowerShell (pure VBS would require similar code):
$ie = New-Object -Com InternetExplorer.Application
$ie.Visible = $true
foreach ($I in 1..3)
  start-sleep 7

Open in new window

C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Aryabhatta MAuthor Commented:
Thanks Qlemo and Bill, I have some doubts and need help in executing it -

[1] (a) Can I save the above code as Launch.vbs in same folder and call it from my batch file like => call "%~dp0\Launch.vbs . Will it work ?
(b) How will I pass the variable value of %NewPort% from batch to this VBS code.

[2]I want to do it for default browser whatever is set in users PC, it may be IE or Mozilla or Chrome.
[Is there any simple way like send keys with f5 and doing some delay in between ? If that is possible how can I write it ?
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
The above is PowerShell code, and belongs into a .PS1 file.

The parameter NewPort is expected as an environment variable already set - exactly as in the batch file.

Calling would work  with powershell -ExecutionPolicy Bypass -File .\Launch.ps1 .

For automation IE is required. Each browser uses its own API to get access to the internal stuff to work with. Using the default browser and sending keys is possible (in PS or VBS) but very unreliable, in particular when having to add delays.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Aryabhatta MAuthor Commented:
Helpful knowledge shared. Thank you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.