赶知识网

利用windows计划任务实现定时运行ASP文件代码

2013-12-29 / 3046次点击 asp/access/IIS/mssql
可能你看到的定时运行ASP文件的方法有多种,不过我现在要说的是一种简单的方法,利用计划任务就可简单的实现。
  首先,你要写一个js或者vbs文件来调用你所有执行的ASP。下面是js和vbs文件的代码,你可以任选一个,执行效果是一样的。

vbs代码-------1.vbs
'Create an instance of IE
Dim IE
Set IE = CreateObject("InternetExplorer.Application")

ie.navigate("http://10.18. ")
ie.visible=1

Set IE = Nothing
---------------------------------


js代码-------------1.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("");

// Show the browser
ie.visible=1;

// Open a stream and write data.
//ie.document.open;
//ie.document.write( html );
//ie.document.close;
------------------------------------
  只要把上面文件中的所有 换成你要执行的ASP文件的URL地址就可以了。这里是URL地址,而不是绝对地址。
  然后打开 WINDOWS 的任务计划,就象选择任何可执行文件一样选择上面一个1.js或者1.vbs文件所在的位置,设定执行时间等,确定就可以了。
  然后这个ASP文件就可以被任务计划定时的运行了,简单吧。

Top10

沪ICP备09053415号 © 赶知识网