Last active
January 5, 2016 13:35
-
-
Save dieseltravis/1181245 to your computer and use it in GitHub Desktop.
Add a shortcut to your Send To menu to launch a folder in IISExpress
This file contains 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 | |
:: normalize folder | |
SET folder=%~1 | |
IF %folder:~-1%==\ SET folder=%folder:~0,-1% | |
:: random number from 8000 to 9999 | |
SET /a port=(%random%)*1999/32767+8000 | |
:: start the web server for the random port starting at the passed-in directory | |
start "IIS Express :%port%" cmd /C " "%ProgramFiles%\IIS Express\iisexpress.exe" /path:"%folder%" /port:%port% /systray:true " | |
:: launch the browser pointing to this location | |
start http://localhost:%port%/ | |
:: To use in Send To: drag a shortcut to this batch file to %APPDATA%\Microsoft\Windows\SendTo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment