Board logo

标题: 重启检查脚本 [打印本页]

作者: Delwo     时间: 2007-12-22 10:02    标题: 重启检查脚本

Option Explicit

Dim objShell, objFSO
Dim nRegReadResult, strPath

Set objShell = CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")

On Error Resume Next
'Win2000/WinXP适用。
objShell.RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations")
nRegReadResult = err.Number        '如果键值存在则为0,否则返回错误代码。
'Win9X适用。
strPath = objShell.ExpandEnvironmentStrings("%windir%\Wininit.ini")

if nRegReadResult = 0 OR objFSO.FileExists(strPath) Then
        objShell.Popup("系统中的某些文件需要更名、删除或替换,建议重新启动系统")
Else
        objShell.Popup("不需要重新启动系统")
End If

[ Last edited by Delwo on 2007-12-22 at 11:30 AM ]