麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 編程 > VBScript > 正文

CreateWeb.vbs 代碼

2020-03-24 18:26:58
字體:
來源:轉載
供稿:網友
'==============================================================================
'
' The .NET PetShop Blueprint Application WebSite Setup
'
' File: CreateWeb.vbs
' Date: November 10, 2001
'
' Creates a new vdir for this project. Set vName to name of folder on disk
' that holds the files.
'
'==============================================================================
'
' Copyright (C) 2001 Microsoft Corporation
'
'==============================================================================
Option Explicit

dim vPath
dim scriptPath
dim vName

vName="PetShop" ' name of web to create

' *****************************************************************************
'
' 1. Create the IIS Virtual Directory
'
' *****************************************************************************
' get html' target='_blank'>current path to folder and add web name to it
scriptPath = left(Wscript.ScriptFullName,len(Wscript.ScriptFullName ) -len(Wscript.ScriptName))
vPath = scriptPath & "Web"

'call to create vDir
CreateVDir(vPath)


' ----------------------------------------------------------------------------
'
' Helper Functions
'
' -----------------------------------------------------------------------------

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Creates a single Virtual Directory (code taken from mkwebdir.vbs and
' changed for single vDir creation).
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub CreateVDir(vPath)

Dim vRoot,vDir,webSite
On Error Resume Next

' get the local host default web
set webSite = findWeb("localhost", "Default Web Site")
if IsObject(webSite)=False then
Display "Unable to locate the Default Web Site"
exit sub
else
'display webSite.name
end if

' get the root
set vRoot = webSite.GetObject("IIsWebVirtualDir", "Root")
If (Err 0) Then
Display "Unable to access root for " & webSite.ADsPath
Exit sub
else
'display vRoot.name
End IF

' delete existing web if needed
vRoot.Delete "IIsWebVirtualDir",vName
vRoot.SetInfo
Err=0 ' reset error

' create the new web
Set vDir = vRoot.Create("IIsWebVirtualDir",vName)
If (Err 0) Then
Display "Unable to create " & vRoot.ADsPath & "/" & vName & "."
exit sub
else
'display vdir.name
end if

' set properties on the new web
vDir.AccessRead = true
vDir.Path = vPath
vDir.Accessflags = 529
VDir.AppCreate False
If (Err 0) Then
Display "Unable to bind path " & vPath & " to " & vRoot.Name & "/" & vName & ". Path may be invalid."
exit sub
end If

' commit changes
vDir.SetInfo
If (Err 0) Then
Display "Unable to save changes for " & vRoot.Name & "/" & vName & "."
exit sub
end if

' report all ok
WScript.Echo Now & " " & vName & " virtual directory " & vRoot.Name & "/" & vname & " created successfully."
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Finds the specified web.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function findWeb(computer, webname)
On Error Resume Next

Dim websvc, site
dim webinfo
Dim aBinding, binding

set websvc = GetObject("IIS://"&computer&"/W3svc")
if (Err 0) then
exit function
end if
' First try to open the webname.
set site = websvc.GetObject("IIsWebServer", webname)
if (Err = 0) and (not isNull(site)) then
if (site.class = "IIsWebServer") then
' Here we found a site that is a web server.
set findWeb = site
exit function
end if
end if
err.clear
for each site in websvc
if site.class = "IIsWebServer" then
'
' First, check to see if the ServerComment
' matches
'
If site.ServerComment = webname Then
set findWeb = site
exit function
End If
aBinding=site.ServerBindings
if (IsArray(aBinding)) then
if aBinding(0) = "" then
binding = Null
else
binding = getBinding(aBinding(0))
end if
else
if aBinding = "" then
binding = Null
else
binding = getBinding(aBinding)
end if
end if
if IsArray(binding) then
if (binding(2) = webname) or (binding(0) = webname) then
set findWeb = site
exit function
End If
end if
end if
next
End Function

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Gets binding info.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
function getBinding(bindstr)

Dim one, two, ia, ip, hn

one=Instr(bindstr,":")
two=Instr((one+1),bindstr,":")

ia=Mid(bindstr,1,(one-1))
ip=Mid(bindstr,(one+1),((two-one)-1))
hn=Mid(bindstr,(two+1))

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 黄色男女视频 | 色中色综合网 | 国产九九 | 精品一区二区三区欧美 | www深夜成人 | 亚洲一区二区中文字幕在线观看 | 久久撸视频 | 亚洲一区二区观看播放 | 毛片毛片| 久久精品视频首页 | 原来神马影院手机版免费 | 日韩一级成人 | 91精品国产综合久久婷婷香 | 亚洲一区在线视频观看 | 国产69精品久久99不卡免费版 | 日韩欧美视频一区二区三区 | 成人福利在线看 | 欧美一区黄色 | 精品国内视频 | 国av在线 | 久久精品免费网站 | 欧美人的天堂一区二区三区 | 日韩黄a | 日本中文字幕电影在线观看 | jj视频在线播放 | 久色成人网 | 日韩视频1 | 久久亚洲激情 | 日本在线视频免费 | 久久最新免费视频 | 99riav国产在线观看 | 大学生一级毛片 | av免费在线观看国产 | 久久久一区二区精品 | 九九精品在线 | 中文区永久区 | 精品国产一区二区三区四区阿崩 | av在线播放观看 | 国产四区 | 国产一级伦理片 | 精品国产91一区二区三区 |