Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Help creating batch file to open/close a website

Posted on 2014-08-19
7
Medium Priority
?
6,407 Views
Last Modified: 2014-08-19
Hi All -

I've been tasked to come up with a way to execute an asp webpage each morning at 9am.  The page performs some calls to my Database and emails the results to a specific set of users.  

I did some research online and found out that I need to create a "Batch" file and have a "Schedule Task" execute it daily.

I've never written a batch file so my question is this:

How does one create a batch file to

A. Open a browser to a specific website/page thus executing the ASP code that emails the results.
B. Close the browser once the page has completely loaded.

Thanks for your help!
0
Comment
Question by:cdemott33
  • 3
  • 2
  • 2
7 Comments
 
LVL 13

Accepted Solution

by:
Gabriel Clifton earned 2000 total points
ID: 40270395
I have actually just done this. This batch file opens youtube and closes after set amount of time ( roughly 8 seconds) by use of pinging self.
@echo off
cls
echo.
echo http://www.youtube.com
start cmd /c "C:\Program Files\Internet Explorer\iexplore.exe" http://www.youtube.com

ping 127.0.0.1 -n 8 -l 0
taskkill /f /im iexplore.exe /t

Open in new window

0
 
LVL 19

Expert Comment

by:Montoya
ID: 40270412
a batch file is basically a text file with some commands.. pretty simple.
It seems, however, that you need a little more functionality. I'd suggest a script like the kind you can create with AutoIT.

https://www.autoitscript.com/site/autoit/

I don't know that they have a way to detect if a page has 'fully loaded'. I guess technically, you could write a value to the user's cache file (assuming the webpage is internal and you designed it".. you could also tell the script to wait a specific amount of time and then close it.
0
 
LVL 19

Expert Comment

by:Montoya
ID: 40270414
Gabriel.. that's a cool use of ping
0
Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

 

Author Comment

by:cdemott33
ID: 40270483
Gabriel -

This line here:

ping 127.0.0.1 -n 8 -l 0
taskkill /f /im iexplore.exe /t

Open in new window


Could you explain to me what it's doing?
0
 
LVL 13

Expert Comment

by:Gabriel Clifton
ID: 40270548
The first line there is executing a ping to act like a pause, the next one kills internet explorer
0
 

Author Closing Comment

by:cdemott33
ID: 40270580
Thanks Gabriel.  I'll give this a try.
0
 
LVL 13

Expert Comment

by:Gabriel Clifton
ID: 40270649
No problem.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lync server 2013 or Skype for business Backup Service Error ID 4049 – After File Share Migration
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…

579 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question