我不抽烟

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
Const AspNetExt="aspx"
Dim Obj,Fso,F,Val,i
Set Obj=New IISClass
Set Fso=CreateObject("Scripting.FileSystemObject")
Set F = Fso.CreateTextFile("是否有Net程序.txt", True)
Obj.GetIIS
i=0
For Each Val In Obj.Site
 i=i+1
 WScript.Echo Fill(i,4) & "正在检测站点 " & Val.Name & " 是否有" & AspNetExt & "文件:"
 Path=Val.Path
 If CheckAspNet(Path) Then
  WScript.Echo vbTab & "有"
  F.WriteLine Fill(Val.Name,25) & Path
 Else
  WScript.Echo vbTab & "没有"
 End If
Next
F.Close()
Set Fso=Nothing
Set Obj=Nothing
Function CheckAspNet(ByRef Path)
 Dim F,Folder,Files,fName,ExtName,dPath
 Dim Fso
 Set Fso=CreateObject("Scripting.FileSystemObject")
 Set F=Fso.GetFolder(Path)
 CheckAspNet=False
 For Each Files In F.Files
  fName=Files.Name
  ExtName=Fso.GetExtensionName(Path & "\" & fName)
  If LCase(ExtName)=LCase(AspNetExt) Then
   CheckAspNet=True
   Exit Function
  End If
 Next
 For Each Folder In F.SubFolders
  dPath=Path & "\" & Folder.Name
  If CheckAspNet(dPath) Then
   CheckAspNet=True
   Exit Function
  End If
 Next
 Set F=Nothing
 Set Fso=Nothing
End Function

Function Fill(byRef Str,byRef L)
 Dim Tmp
 If CLng(L)<=Len(Str) Then
  Fill=Str
  Exit Function
 End If
 Tmp=Str & Space(L)
 Fill=Left(Tmp,L)
End Function
posted on 2012-04-22 20:43  小李弯刀  阅读(225)  评论(0编辑  收藏  举报