Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run a Batch File when a Web Page is Opened

Status
Not open for further replies.

ericsmith1172

Programmer
Oct 24, 2003
1
US
Basically I am running an Intranet (not Internet) based Web Page (same scripting anyway). What I am trying to accomplish is that when the company opens our Intranet page the time and date are synchronized to our server. Our normal command is:
'net time \\[Server Name] /set /y'
(Which is also sent up as a batch file. "Clock_Sync.Bat")

How do I get this command and/or batch file to run when a Web Page is opened? (I don't want for the employees to have the option to download the batch file, I just want it to run and sync the clocks.)

What is the script I need?
I started with:
<script>
wshl = new ActiveXObject(&quot;WScript.Shell&quot;)
wshl.run(&quot;start e:\\[Folder Name]\Clock_Sync.Bat&quot;)
</script>

This works locally but not over a network. It will open the window (doesn't process the batch file or command) then closes. The open and close affect I wanted, it's just not running the batch file.
 
the reason it works locally is because presumably your computer trusts things you've downloaded... however, that won't work on your intranet because what would keep you from executing any script? you need to have the browser &quot;trust&quot; your script. And for that you might want to check an ActiveX forum, not an HTML forum... you have a permissions issue. <p>Liam Morley<br><A HREF="mailto:"></A><br>&quot;light the deep, and bring silence to the world.<br>light the world, and bring depth to the silence.&quot;
 
Since you already have the batch file, the simplest thing to do would be put it in the login script that runs whenever someone signs on to your network. That way, whenever anyone logs on to their computer the date and time are synchronized with your server as part of the computer's login process, regardless of whether they open the Intranet or not. Unless, of course you have some reason to allow the computers to keep different dates/times until they log on to the Intranet.

Hope This Helps!

Ecobb
- I hate computers!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top