使用JS,可以替代Windows安装方式:
代码也比较简单:)
创建一个setup.js文件,内容为:
varfso=newActiveXObject("Scripting.FileSystemObject")varsvcPath="IIS://localhost/W3SVC/1"varsvcRoot=GetObject(svcPath)varwebRoot=svcRoot.GetObject("IIsWebVirtualDir","Root")try{varobjVDir1=webRoot.Create("IIsWebVirtualDir","dbnetoffice")objVDir1.Path=fso.GetAbsolutePathName(".")objVDir1.AppCreate(2)objVDir1.AppFriendlyName="DotNetDemo"objVDir1.SetInfo()}catch(ex){//WScript.Echo(ex.description+"("+ex.number+")")}varo=newActiveXObject("WScript.NetWork")varwshShell=newActiveXObject("WScript.Shell")wshShell.Run("iexplore.exehttp://"+o.ComputerName+"/DotNetDemo/default.aspx")会创建虚拟目录DotNetDemo虚拟目录,并且打开一个浏览器,浏览DotNetDemo虚拟目录中的default.aspx文件.