Created
January 16, 2011 15:39
-
-
Save joshuaflanagan/781893 to your computer and use it in GitHub Desktop.
Launch IIS Express from the command line
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
@ECHO OFF | |
SET IIS="c:\Program Files (x86)\IIS Express\iisexpress.exe" | |
SET ARG=%1 | |
REM Default to curret directory if no path provided | |
IF [%ARG%] == [] ( | |
SET root=%CD% | |
GOTO launch | |
) ELSE ( | |
SET CHECKPARAM=x%ARG%x | |
IF %CHECKPARAM:~1,1% == / ( | |
SET root=%CD% | |
GOTO launch | |
) ELSE SHIFT | |
) | |
REM Strip any quotes around path | |
FOR /f "useback tokens=*" %%a in ('%ARG%') DO SET ARG=%%~a | |
REM Make the path absolute | |
IF %ARG:~1,1% == : (SET root=%ARG%) ELSE ( | |
IF %ARG:~0,1% == \ (SET root=%CD:~0,2%%ARG%) ELSE (SET root=%CD%\%ARG%) | |
) | |
:launch | |
IF NOT EXIST %root% ( | |
ECHO Invalid path: %root% | |
GOTO :EOF | |
) | |
START "IIS Express - %root%" CMD /C "%IIS% /path:"%root%" %1 %2 %3 %4 %5 %6 %7 %8" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment