Created
March 10, 2011 15:56
-
-
Save duncansmart/864322 to your computer and use it in GitHub Desktop.
IISExpress runner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Runs IIS Express without a console window (if started with wscript.exe) | |
var sitePort = 8080; | |
var sitePath = "."; | |
var siteClr = "v4.0"; | |
var fso = new ActiveXObject("Scripting.FileSystemObject"); | |
var wshell = new ActiveXObject("WScript.Shell"); | |
// Resolve path | |
sitePath = fso.GetAbsolutePathName(sitePath); | |
// look for IISExpress | |
var iisexpress = wshell.ExpandEnvironmentStrings("%ProgramFiles%\\IIS Express\\iisexpress.exe"); | |
if (!fso.FileExists(iisexpress)) { | |
iisexpress = wshell.ExpandEnvironmentStrings("%ProgramFiles(x86)%\\IIS Express\\iisexpress.exe"); | |
if (!fso.FileExists(iisexpress)) { | |
WScript.Echo("Couldn't find IIS Express. Install using the Web Platform Installer."); | |
WScript.Quit(1); | |
} | |
} | |
// launch browser | |
wshell.Run('http://localhost:' + sitePort, 1, false); | |
// start IISExpress hidden and wait for exit | |
wshell.Run('"' + iisexpress + '" /port:' + sitePort + ' /clr:' + siteClr + ' /path:"' + sitePath + '"', 0, true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment