⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getfiledir.vbs

📁 Apress - Managing Enterprise Systems With The Windows Script Host Source Code
💻 VBS
字号:
'Description
'Returns specified file or directory object
'Parameters
'strPath     File name to search for
'objIISPath  IIS object container to retrieve object from
Function GetFileDir(strPath, objIISPath)
Dim strObjectClass, objWebFileDir, objFSO

On Error Resume Next

'attempt to get the object from specified container
Set objWebFileDir = objIISPath.GetObject(strObjectClass, strPath)

'check if error occured - could not get object
If Err Then
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    
    'check if specified path is a file..
    If objFSO.FileExists(objIISPath.Path & "\" & strPath) Then
        'create the file object
        Set objWebFileDir = objIISPath.create("IIsWebFile", strPath)
    'check if specified path is a directory..
    ElseIf objFSO.FolderExists(objIISPath.Path & "\" & strPath) Then
       'create the directory object
       Set objWebFileDir = objIISPath.create("IIsWebDirectory", strPath)
    Else
        Set objWebFileDir = Nothing
    End If

End If

Set GetFileDir = objWebFileDir
End Function

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -