QTP之执行脚本后关机函数

上一篇 / 下一篇  2013-07-12 14:53:38 / 个人分类:QTP自动化测试

'============================================================================
'   脚本名称:Shutdown_test computer      
'   操作系统: windows7  
'   脚本作者:   xxxx  
'   编写日期:  2013-7-9  
'   测试功能: 判断是否要在运行测试结束的时候关机
'============================================================================
Option Explicit
Dim MyVar,ws
MyVar = MsgBox ("执行完自动化测试后,您希望关机吗?", 3, "执行测试机器是否关闭")
If  MyVar = "6"   Then
Set ws=CreateObject("wscript.shell")
' 当时间是晚上23时
Do While Hour(Now)=12
' 执行shutdown命令,-s 是本机,-t 是过多长时间关机,我设置的是0; 就是立马关机;
   ws.Run "cmd.exe /c shutdown -s -t  0"
loop
End If

TAG:

 

评分:0

我来说两句

Open Toolbar