让服务器自动运行ASP脚本每一天 [英] Make server automatic run asp-script every day

查看:167
本文介绍了让服务器自动运行ASP脚本每一天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能创建一个批处理文件,它会打开火狐,运行一个网站,然后关闭火狐一次?

Is it possible to create a batch-file which opens firefox, runs a website and then closes firefox again?

是这样的:

@echo off
start firefox http://.....

这是我在哪里卡住了...这需要关闭firefix时,再次网站加载完毕。

This is where I am stuck... It needs to close firefix again when the website is finished loading.

这是用来每天晚上23:59运行维护脚本。
剧本是基于本地的,但一个人不能运行的asp文件,而无需使用一个服务器,所以我把它作为一个网站。

It is used to run a maintenance-script every night at 23:59. The script is based locally, but one cannot run a asp-file without using a server, so I have placed it as a website.

推荐答案

从文章年前,我就写了aspfaq.com改编。

使用AT命令和Windows脚本宿主(或更基本的任务调度程序),以安排在一定的时间间隔一个VBS文件。

Use the AT command and Windows Scripting Host (or the more rudimentary task scheduler) to schedule a VBS file at certain intervals.   

首先,在ASP更改为VBS文件。这是通过(1)改变扩展VBS完成; (2)所有的Server.CreateObject调用的CreateObject变化;和(3)消除所有< %%> 分隔符和任何浏览器注定code(例如,的Response.Write语句或客户端HTML) 。我没有遇到任何进一步的并发症,但情况因人而异。

First, change the ASP to a VBS file. This is accomplished by (1) changing the extension to VBS; (2) changing all Server.CreateObject calls to CreateObject; and, (3) removing all <%%> delimiters and any browser-destined code (for example, response.write statement or client-side HTML). I didn't run into any further complications, but YMMV.   

您存储在文件系统中的VBS文件,并使用AT命令来安排它(这实际上调度其执行与Windows的调度服务)。在命令提示符下,你可以使用AT本身,看看目前在计划任务的列表。您可以使用AT /?找出其所有的语法可能性。

You store the VBS file in the filesystem, and use the AT command to schedule it (this actually schedules its execution with Windows's schedule service). At a command prompt, you can use AT by itself to see a list of tasks currently in the schedule. You can use AT /? to find out all its syntax possibilities. 

例如,要获得一个文件在上午9:00运行的每个周日,我推出这个批处理文件(第一行清除现有条目):
      

For example, to get a file to run every weekday at 9:00 am, I launch this batch file (the first line clears existing entries):     

at /delete /y 
at 9:00 /every:m,t,w,th,f d:\net\shared\getdata.vbs      

的通知没有涉及Web服务器;该文件是直接通过文件系统访问。一旦我得到了在用户必须先登录和任务,必须重新启动时复位障碍(这两个我认为是与特定的机器,是不是我们的控制之下的问题),所有已运行对我罚款。

Notice there is no web server involved; the file is accessed directly through the file system. Once I got over the "a user has to be logged in" and "the tasks have to be reset when rebooted" hurdles (both of which I believe are problems with the particular machine that is not under our control), all has been running fine for me. 

有关使用WSH的例子,CDONTS和任务计划程序来发送电子邮件定期,请参见 KB#221495

For an example of using WSH, CDONTS and the Task Scheduler to send out e-mails on a regular basis, see KB #221495. 

如果你正在做的是SQL Server数据库的工作,你可能会考虑使用工作。这将让你保持工作的所有处理的数据库中,和prevent与多个系统,连接相关的并发症,适应ASP code是非ASP般的行为。

If all you are doing is database work in SQL Server, you might consider using a job. This will allow you to keep all the processing of the job within your database, and prevent the complications associated with multiple systems, connections, and adapting ASP code to be non-ASP-like in behavior.

这篇关于让服务器自动运行ASP脚本每一天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆