Skip to content

Instantly share code, notes, and snippets.

@duncansmart
Created March 10, 2011 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save duncansmart/864232 to your computer and use it in GitHub Desktop.
Save duncansmart/864232 to your computer and use it in GitHub Desktop.
IISExpress runner
:: Runs IIS Express and exits. IIS Express is kept alive by WScript.exe
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: NOTE, these are ignored if a file called IISExpress.config exists
set SITE_PORT=8080
set SITE_PATH=%~dp0
set SITE_CLR=v4.0
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
set IISEXPRESS=%ProgramFiles%\IIS Express\iisexpress.exe
if not exist "%IISEXPRESS%" set IISEXPRESS=%ProgramFiles(x86)%\IIS Express\iisexpress.exe
if not exist "%IISEXPRESS%" (
echo Could not find IIS Express. Please install using Web Platform Installer.
pause
exit
)
:: Trim any trailing slash. The /path switch doesn't like it
if %SITE_PATH:~-1% == \ set SITE_PATH=%SITE_PATH:~0,-1%
set VBSFILE="%TEMP%\iisexpressrun-%SITE_PORT%.vbs"
echo CreateObject("WScript.Shell").Run """%IISEXPRESS%"" /port:%SITE_PORT% /clr:%SITE_CLR% /path:""%SITE_PATH%"" ", 0, True > %VBSFILE%
start wscript.exe %VBSFILE%
start http://localhost:%SITE_PORT%/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment