Scripting the XP IIS single site limitation
The single site limitation in IIS on XP is frustrating. Since I can't have more then one site on the box, I needed a way to quickly change the Home Directory of the root web. To satisfy my need I came up with this little script.
' setw3.vbs
Dim objArgs
Set objArgs = WScript.Arguments
If objArgs.Length = 0 Then
' Use the current patch
Set WshShell=WScript.CreateObject("WScript.Shell")
Set fs = CreateObject("Scripting.FileSystemObject")
currentPath = fs.GetAbsolutePathName(".\")
Else
currentPath = objArgs.Item(0)
End If
Set IISObject = GetObject("IIS://LocalHost/w3svc/1/Root")
IISObject.Path = currentPath
IISObject.Setinfo
I put this script in my path and can call it from the command line or a batch file.
For example:
w3set “e:\dev\project1“
or a batch file sitting on my Desktop
cd /D e:\dev\project1
w3set