CreateWeb.vbs 代碼
2019-10-26 17:59:46
供稿:網友
 
				'============================================================================== 
' 
'  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 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")