惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Secure Thoughts
Security Latest
Security Latest
Simon Willison's Weblog
Simon Willison's Weblog
O
OpenAI News
GbyAI
GbyAI
L
LINUX DO - 最新话题
A
Arctic Wolf
T
Tor Project blog
G
GRAHAM CLULEY
I
InfoQ
博客园_首页
IT之家
IT之家
The Register - Security
The Register - Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
The GitHub Blog
The GitHub Blog
Blog — PlanetScale
Blog — PlanetScale
N
Netflix TechBlog - Medium
K
Kaspersky official blog
博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题
U
Unit 42
PCI Perspectives
PCI Perspectives
量子位
P
Palo Alto Networks Blog
S
Securelist
T
Troy Hunt's Blog
博客园 - 【当耐特】
Recorded Future
Recorded Future
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
Security Affairs
Engineering at Meta
Engineering at Meta
T
The Blog of Author Tim Ferriss
博客园 - 聂微东
罗磊的独立博客
N
News and Events Feed by Topic
人人都是产品经理
人人都是产品经理
B
Blog RSS Feed
NISL@THU
NISL@THU
C
Cisco Blogs
T
Threatpost
有赞技术团队
有赞技术团队
Forbes - Security
Forbes - Security
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
T
The Exploit Database - CXSecurity.com
Cloudbric
Cloudbric
Cyberwarzone
Cyberwarzone
Google DeepMind News
Google DeepMind News
C
Cyber Attacks, Cyber Crime and Cyber Security

博客园 - 小牛哥

招聘.NET软件工程师 2人 招聘.NET软件工程师 2人 招聘.NET高级程序员[深圳] Windows 2003不能用 '..' 表示父目录解决方法 使用JS创建虚拟目录,并引导进入浏览 判断一个字符是否为汉字 Migration from J2EE to .NET 无法打开 Web 项目“DottextWeb”问题的解决 如何解决一个小问题:当前不会命中断点 Lucene.Net的问题我找到了,郁闷 插入表情图标的功能 事务死锁的问题如何解决? Unclean shutdown of previous Apache run? - 小牛哥 VB.NET实现Singleton模式 启动一个进层阻止当前线程 使用DataReader填充DataTable Asc和Chr 获得一个随机数 将Html代码转换为Text
创建虚拟目录和移除虚拟目录 - 小牛哥 - 博客园
小牛哥 · 2004-10-19 · via 博客园 - 小牛哥

创建虚拟目录和移除虚拟目录

创建一个vbs文件:

' Creates\removes IIS Virtual Folders

if WScript.Arguments.Count<2 then 
  WScript.Echo 
"Wrong arguments."
  WScript.Quit(0)
end if
sAction 
= WScript.Arguments(0)
if sAction="Create" then
  
if WScript.Arguments.Count<3 then
    WScript.Echo 
"Wrong arguments."
    WScript.Quit(0)
  
end if
  sName 
= WScript.Arguments(1)
  sPath 
= WScript.Arguments(2)
  
On Error Resume Next
  
Set fso = CreateObject("Scripting.FileSystemObject")
  sPath 
= fso.GetAbsolutePathName(sPath)
  
If Err.Number<>0 then
    Err.Clear
    WScript.Echo 
"Can't create '" & sName & "': invalid virtual folder path."
    WScript.Quit(0)
  
end if
  
Set oIIS = GetObject("IIS://localhost/W3SVC/1/Root")
  
If Err.Number<>0 then
    Err.Clear
    WScript.Echo 
"Error creating '" & sName & "' virtual folder: can't access IIS."
    WScript.Quit(0)
  
end if
  
Set oDir = oIIS.GetObject("IISWebVirtualDir", sName)
  
' This will return error -2147024893 if it doesn't exist
  If Err.Number=0 then
    WScript.Echo 
"Can't create '" & sName & "': virtual folder already exists."
    WScript.Quit(0)
  
end if
  Err.Clear
  
Set oDir = oIIS.Create("IISWebVirtualDir", sName)
  oDir.AccessScript 
= True
  oDir.Path 
= sPath
  oDir.SetInfo
  oDir.AppCreate 
True
  oDir.SetInfo
elseif sAction="Remove" then
  sName 
= WScript.Arguments(1)
  
On Error Resume Next
  
Set oIIS = GetObject("IIS://localhost/W3SVC/1/Root")
  
If Err.Number<>0 then
    Err.Clear
    WScript.Echo 
"Error removing '" & sName & "' virtual folder: can't access IIS."
    WScript.Quit(0)
  
end if
  
Set oDir = GetObject("IIS://localhost/W3SVC/1/Root/" & sName)
  
If Err.Number<>0 then
    Err.Clear
    WScript.Echo 
"Error removing '" & sName & "': virtual folder doesn't exist."
    WScript.Quit(0)
  
else
    Err.Clear
    
'No error so directory registration exists, we need to remove it
    Set oIIS  = GetObject("IIS://localhost/W3SVC/1")
    
Set oRoot = oIIS.GetObject("IIsWebVirtualDir","Root")
    oRoot.Delete 
"IIsWebVirtualDir", sName
  
End if
end if

创建一个虚拟目录
建立一个bat文件,其内容为:

@echo off
wscript.exe IISVirtualFolderTool.vbs Create DoPetShop         "..\Samples\DoPetShop\Web"
wscript.exe IISVirtualFolderTool.vbs Create Demo_WebTransfers "..\Samples\Demo_WebTransfers"

移除虚拟目录
建立一个bat文件,其内容为:

@echo off
wscript.exe IISVirtualFolderTool.vbs Remove DoPetShop
wscript.exe IISVirtualFolderTool.vbs Remove Demo_WebTransfers

咱们的Blog还不支持VBS和bat这种代码

posted on 2004-10-19 17:33  小牛哥  阅读(2127)  评论(1)    收藏  举报