使用JS创建虚拟目录,并引导进入浏览
使用JS,可以替代Windows安装方式:
代码也比较简单:)
创建一个setup.js文件,内容为:
var fso = new ActiveXObject("Scripting.FileSystemObject")
var svcPath = "IIS://localhost/W3SVC/1"
var svcRoot = GetObject(svcPath)
var webRoot = svcRoot.GetObject("IIsWebVirtualDir", "Root")
try
{
var objVDir1 = webRoot.Create("IIsWebVirtualDir", "dbnetoffice")
objVDir1.Path = fso.GetAbsolutePathName(".")
objVDir1.AppCreate(2)
objVDir1.AppFriendlyName = "DotNetDemo"
objVDir1.SetInfo()
}
catch(ex)
{
// WScript.Echo(ex.description + "(" + ex.number + ")" )
}
var o = new ActiveXObject("WScript.NetWork")
var wshShell = new ActiveXObject("WScript.Shell")
wshShell.Run("iexplore.exe http://" + o.ComputerName + "/DotNetDemo/default.aspx")
会创建虚拟目录DotNetDemo虚拟目录,并且打开一个浏览器,浏览DotNetDemo虚拟目录中的default.aspx文件.
很简单,不罗嗦.
代码也比较简单:)
创建一个setup.js文件,内容为:
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
会创建虚拟目录DotNetDemo虚拟目录,并且打开一个浏览器,浏览DotNetDemo虚拟目录中的default.aspx文件.
很简单,不罗嗦.