|
如何准确定时运行ASP文件(1) 在一定的时候,要定时的运行某个ASP文件去执行一个任务,如一个工厂在早上9点钟要采集所有的电表的读数,当然这要通过IN SQL连接到各个电表中,我们现在就是用一个ASP文件把IN SQL中表的读数再集中到MS SQL中。
可能你看到的定时运行ASP文件的方法有多种,不过我现在要说的是一种简单的方法,利用计划任务就可简单的实现。
首先,你要写一个js或者VBs文件来调用你所有执行的ASP。下面是js和vbs文件的代码,你可以任选一个,执行效果是一样的。
vbs代码------------------------- 'CODE BY 小荷 aston314@sohu.com 'Create an instance of IE Dim IE Set IE = CreateObject("InternetEXPlorer.Application")
'运行你的 URL
ie.navigate("http://www.knowsky.com/") ie.visible=1
'Clean up... Set IE = Nothing ---------------------------------
你可以取任何名称,但后缀名一定要是vbs,在这里我们取名do.vbs。
js代码--------------------------- var html = ""; html += "<html><head><title>运行窗口</title></head><body>"; html += "<font face=verdana></font>"; html += "</body></html>";
// Create Internet Explorer Object ie = new ActiveXObject("InternetExplorer.Application");
// Define how the window should look ie.left = 50; ie.top = 50; ie.height = 510; ie.width = 470; ie.menubar = 0; ie.toolbar = 0;
// Set the browser to a blank page ie.navigate("http://www.knowsky.com/");
// Show the browser ie.visible=1;
// Open a stream and write data. //ie.document.open;
|