您好,登錄后才能下訂單哦!
本篇內(nèi)容介紹了“mdir.vbs怎么建立隱藏虛擬目錄的vbs”的有關(guān)知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細閱讀,能夠?qū)W有所成!
建立隱藏虛擬目錄使用。首先要先在對應(yīng)WEB目錄里建立一個目錄。然后利用腳本直接在Shell中創(chuàng)建虛擬目錄。僅僅為了方便大家使用。方法如下
C:\>mdir.vbs
***************************************************************************
Usage: MDir <-w WebSite Index>
<-v Name1,Path2,Name2,Path3,...>
Example : MDir -w 1 -v "Root/Disk-C","C:\","Root/Disk-D","D:\"
***************************************************************************
Index ServerComment
___________________________________________________________________________
1 asp.com
2 asp.net
3 aspx.net
4 aspx.com
5 tmp.com
6 tmp.net
不加任何參數(shù)時,會將IIS中所有主機頭羅列出來。
如果你想在 asp.com 中創(chuàng)建,則需要記準對應(yīng)的 Index值。格式如下
C:\inetpub\wwwroot>md Root
C:\inetpub\wwwroot>Cscript mdir.vbs -w "1" -v "Root/Disk-c","c:\"
C:\inetpub\wwwroot>rd Root
就在此域名下創(chuàng)建了一個隱藏的虛擬目錄。
訪問方法:
http://asp.com/Root/Disk-c
復(fù)制代碼 代碼如下:
'Lilo 編寫
'Lilo@Bugkidz.org
On Error Resume Next
Dim oArgs, ArgNum, ArgComputer, ArgWebSites, ArgVirtualDirs, ArgDirNames(), ArgDirPaths(), DirIndex, ArgComputers
Set oArgs = WScript.Arguments
ArgComputers = Array("LocalHost")
ArgNum = 0
While ArgNum < oArgs.Count
If (ArgNum + 1) >= oArgs.Count Then
Call DisplayUsage
End If
Select Case LCase(oArgs(ArgNum))
Case "-w":
ArgNum = ArgNum + 1
ArgWebSites = oArgs(ArgNum)
Case "-v":
ArgNum = ArgNum + 1
ArgVirtualDirs = Split(oArgs(ArgNum), ",", -1)
Case "-?"
Call DisplayUsage
End Select
ArgNum = ArgNum + 1
Wend
ArgNum = 0
DirIndex = 0
MaxWeb = CLng(ListAllWeb(0))
If Not IsNumeric(ArgWebSites) Or MaxWeb = 0 Then Call DisplayUsage
ReDim ArgDirNames((UBound(ArgVirtualDirs)+1) \ 2)
ReDim ArgDirPaths((UBound(ArgVirtualDirs)+1) \ 2)
if isArray(ArgVirtualDirs) then
While ArgNum <= UBound(ArgVirtualDirs)
ArgDirNames(DirIndex) = ArgVirtualDirs(ArgNum)
If (ArgNum + 1) > UBound(ArgVirtualDirs) Then
WScript.Echo "Error understanding virtual directories"
Call DisplayUsage
End If
ArgNum = ArgNum + 1
ArgDirPaths(DirIndex) = ArgVirtualDirs(ArgNum)
ArgNum = ArgNum + 1
DirIndex = DirIndex + 1
Wend
end if
If (ArgWebSites = "") Or (IsArray(ArgDirNames) = False or IsArray(ArgDirPaths) = False) Then
Call DisplayUsage
Else
Dim compIndex
for compIndex = 0 to UBound(ArgComputers)
Call ASTCreateVirtualWebDir(ArgComputers(compIndex),ArgWebSites,ArgDirNames,ArgDirPaths)
next
End If
Sub Display(Msg)
WScript.Echo Now & ". Error Code: " & Hex(Err) & " - " & Msg
End Sub
Sub Trace(Msg)
WScript.Echo Now & " : " & Msg
End Sub
Sub DisplayUsage()
WScript.Echo String(75,"*") & vbCrLf & "Usage: MDir <-w WebSite Index>" & vbCrLf & " <-v Name1,Path2,Name2,Path3,...>" & vbCrLf & "Example : MDir -w 1 -v ""Root/Disk-C"",""C:\"",""Root/Disk-D"",""D:\""" & vbCrLf & String(75,"*") & vbCrLf & ListAllWeb(1)
WScript.Quit
End Sub
Sub ASTCreateVirtualWebDir(ComputerName,WebSiteName,DirNames,DirPaths)
Dim Computer, webSite, WebSiteID, vRoot, vDir, DirNum
On Error Resume Next
Set webSite = GetObject("IIS://Localhost/W3SVC/" & WebSiteName)
if IsObject(webSite) then
set vRoot = webSite.GetObject("IIsWebVirtualDir", "Root")
Trace "Accessing Root For " & webSite.ADsPath
If (Err <> 0) Then
Display "Unable To Access Root for " & webSite.ADsPath
Else
DirNum = 0
If (IsArray(DirNames) = True) And (IsArray(DirPaths) = True) And (UBound(DirNames) = UBound(DirPaths)) Then
While DirNum < UBound(DirNames)
Set vDir = vRoot.Create("IIsWebVirtualDir",DirNames(DirNum))
If (Err <> 0) Then
Display "Unable To Create " & vRoot.ADsPath & "/" & DirNames(DirNum) &"."
Else
vDir.EnableDirBrowsing = True
vDir.DirBrowseShowDate = False
vDir.DirBrowseShowTime = False
vDir.DirBrowseShowSize = False
vDir.DirBrowseShowExtension = False
vDir.DirBrowseShowLongDate = True
vDir.DirBrowseFlags = -1073741762
vDir.AccessRead = True
vDir.AccessWrite = False
vDir.AccessExecute = False
vDir.AccessScript = False
vDir.AccessSource = False
vDir.AccessNoRemoteRead = False
vDir.AccessNoRemoteWrite = False
vDir.AccessNoRemoteExecute = False
vDir.AccessNoRemoteScript = False
vDir.AppIsolated = 1
vDir.AccessFlags = 1
vDir.ContentIndexed = False
vDir.CreateProcessasUser = False
vDir.DontLog = True
' vDir.DefaultDoc = ""
vDir.EnableDefaultDoc = False
vDir.AppFriendlyName = ""
vDir.AppCreate2 3
vDir.Path = DirPaths(DirNum)
If (Err <> 0) Then
Display "Unable To Bind Path " & DirPaths(DirNum) & " to " & vRootName & "/" & DirNames(DirNum) & ". Path may be invalid."
Else
'Save the changes
vDir.SetInfo
If (Err <> 0) Then
Display "Unable To Save Configuration For " & vRootName & "/" & DirNames(DirNum) &"."
Else
Trace "Web Virtual Directory " & vRootName & "/" & DirNames(DirNum) & " created successfully."
End If
End If
End If
Err = 0
DirNum = DirNum + 1
Wend
End If
End If
else
Display "Unable To Find "& WebSiteName &" on "& ComputerName
End if
Trace "Done."
End Sub
Function ListAllWeb(n)
Set ObjService=GetObject("IIS://LocalHost/W3SVC")
If n = 1 Then ListAllWeb = "" Else ListAllWeb = 0
For Each obj3w In objservice
If IsNumeric(obj3w.Name) Then
sServerName=Obj3w.ServerComment
If n = 1 Then
ListAllWeb = ListAllWeb & obj3w.Name & String(15-Len(obj3w.Name)," ") & obj3w.ServerComment & vbCrLf
Else
ListAllWeb = ListAllWeb + 1
End If
End If
Next
if n = 1 Then ListAllWeb = "Index" & String(10," ") & "ServerComment" & vbCrLf & String(75,"_") & vbCrLf & ListAllWeb
Set ObjService=Nothing
End Function
“mdir.vbs怎么建立隱藏虛擬目錄的vbs”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識可以關(guān)注億速云網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實用文章!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。