Get the name of the default web site

On Azure, the name of the default website changes according to the name and number of the instance. If you need to include the name of the site in any appcmd scripts, you can get it in a bat file like this:

%systemroot%\system32\inetsrv\appcmd list sites /text:site.name > temp.txt
set /p sitename= < temp.txt
echo %sitename%
Advertisements