使用ASP脚本命令重新启动服务器
作者:酷酷の鱼 来源:安全中国 时间:2008-10-10 11:53:00
大家知道直接使用ASP是不能够重启服务器的,这时我们需要制作一个组件来实现功能,ASP通过这个组件调用系统API,然后按照不同的重启和关机方式进行操作!
下面先说COM的制作,在VB中新建一工程,当然是AceiveX dll的!
1)先修改工程属性,在工程属性窗口将工程名称改为system,在类模块窗口将模块名称改为contral,保存工程;
2)然后添加一个模块,用来声明需要使用的API和常数!下面是模块中的内容!
Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
3)在类模块中输入下列代码:
Public Function reboot(atype As Variant)
t& = ExitWindowsEx(1, atype)
End Function
该函数需要传入一个参数,用来控制启动方式,这个参数是从ASP程序中传入的,等一下就可以看到具体的使用方法!
编写完上面的代码,保存工程,将工程编译为system.dll。下面就写ASP程序!
ASP中的代码非常简单:
<%
atype=request("atype")
set sys=server.CreateObject ("system.contral")
sys.reboot(atype)
%>
其中atype可以使用0、1、2、4,0、1和4均为关机,2用来重启。写完后执行ASP就可以了!
标签:命令,组件,服务器,asp
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
何在MySQL数据库中定义外键
2009-12-17 12:29:00
asp如何遍历目录及目录下的文件?
2009-11-11 17:55:00
使用VS2005调试ASP程序方法
2007-11-02 09:56:00
![](https://img.aspxhome.com/file/UploadPic/200711/2/200711210317494s.jpg)
深入浅出的SQL server 查询优化
2010-07-02 20:58:00
获取Dom元素的X/Y坐标
2009-10-10 12:49:00
![](https://img.aspxhome.com/file/UploadPic/200910/10/123-57s.gif)
oracle 字符串转成行
2009-06-19 17:38:00
FrontPage2003 中网页布局功能的应用
2007-11-18 14:43:00
![](https://img.aspxhome.com/file/uploadpic/200711/18/20071118144520978.jpg)
简单form标准化实例——语义结构
2007-06-20 16:32:00
最具创意的广告牌全集
2007-09-21 19:54:00
![](https://img.aspxhome.com/file/UploadPic/20079/21/200792120756728s.jpg)
一些SQL查询语法参考
2007-10-14 11:56:00
网站导航设计模式指南
2011-03-04 16:12:00
![](https://img.aspxhome.com/file/UploadPic/20113/4/01-14s.jpg)
Dreamweaver如何制作会移动的广告条
2010-10-20 20:04:00
指导:SQL Server无日志恢复数据库
2009-02-20 17:07:00
在ASP处理程序时,进度显示
2008-08-04 13:27:00
轻松解决AJAX的中文乱码问题
2008-09-03 12:55:00
网站构成的基本元素—网页布局
2008-01-04 09:49:00
aspjpeg 半透明描边的实现函数
2008-12-17 12:02:00
![](https://img.aspxhome.com/file/UploadPic/200812/17/17_172743_1-89s.jpg)
css可以给img元素设置背景图
2008-09-29 15:35:00
oracle学习笔记(三)
2012-01-05 19:28:42
70+漂亮且极具亲和力的导航菜单设计推荐[译]
2009-02-23 13:15:00
![](https://img.aspxhome.com/file/UploadPic/up/2009022313285860.gif)