Start Development IIS Express Server (tested on Win7 and Win10 with mapped network drives)


@echo off
REM Script will start IIS Express on the specific port with the folder FROM WHICH SCRIPT IS CALLED
REM 
REM IIS Express does the following:
REM * Copies default applicationhost.config file ("C:\Program Files\IIS Express\AppServer\applicationhost.config") to %TEMP%\IISEXPRESS\APPLICATIONHOST{TimeStampGoesHere}.CONFIG (where timestamp is current date+time with milliseconds)
REM * The copied config file is modified to specify the physical path (<application ...> --> <virtualDirectory ...> physicalPath property) and the port (<bindings> -> <binding ...> bindingInformation property) 
REM * Path to custom configuration file can also be provided in the command line using /config:{FullPathToIISApplicationHostCustomConfigFile}

set iisexpress_loc="C:\Program Files\IIS Express\iisexpress.exe"
set folder_loc=%cd%
set port_loc=2018

if [%1]==[--help] goto syntax
if [%1]==[/?] goto syntax

if [%1]==[] goto proceed
set port_loc=%1

:proceed
echo.
echo Make "%folder_loc%" accessible from "http://localhost:%port_loc%" ...
echo.

%iisexpress_loc% /path:"%folder_loc%" /port:%port_loc% /trace:w /systray:true

goto exit

:syntax
echo.
echo Syntax: %0 PortNumberGoesHere
echo         Default Port: %port_loc%
echo.
goto exit

:exit
echo.
echo.
echo.
pause