@echo off
title Industrial belt project deployment script
echo 1. This script is only suitable for the first installation
echo 2. Please check and modify the following variable values before deployment
echo Sitename: Site name, please separate with spaces or commas
echo BackPort: Site bound port
echo NetVersion: .netVersion(as:v4.0)
echo NetModel: Program operation mode classic (Integrated) or integrated (Classic)
setAppCmd=C:\Windows\System32\inetsrv\appcmd.exe
setSitename=admin.example.com www.example.com
setSitePath=C:\weboxb\example.com
setBackPort=8010
setNetVersion=v4.0
setNetModel=Integrated
setLogPath=D:\iislogs\
:: Confirm variable initialisationecho Confirming the initialisation:
echo AppCmd=%AppCmd%echo Sitename=%Sitename%echo SitePath=%SitePath%echo BackPort=%BackPort%echo NetVersion=%NetVersion%echo NetModel=%NetModel%echo LogPath=%LogPath%pause(for%%a in(%Sitename%)do(echo Creating application pool for %%a
%AppCmd% add apppool /name:%%a /managedRuntimeVersion:%NetVersion% /managedPipelineMode:%NetModel%iferrorlevel1gotoErrorecho Creating site directory for %%a
mkdir%SitePath%\%%a
iferrorlevel1gotoErrorecho Creating site for %%a
%AppCmd% add site /name:%%a /bindings:"http://%%a:%BackPort%" /physicalpath:%SitePath%\%%a
iferrorlevel1gotoErrorecho Associating application pool for %%a
%AppCmd% set site /site.name:%%a /[path='/'].applicationPool:%%a
iferrorlevel1gotoErrorecho.
))echo The execution is complete, please check the execution log at %LogPath%.
gotoEnd:Errorecho An error occurred. Please check the configurations and try again.
pauseexit:Endpause
@echo off
title update site bind domain
echo Please carefully check the configuration content!
pausesetAppCmd=C:\Windows\System32\inetsrv\appcmd.exe
setBackPort=80
setDomainName=example.cn
setNewDomainName=example.com
:: Specify log location:: set LogPath=D:/iislogs/:: /logfile.directory:%LogPath%%AppCmd% set SITE "www.%DomainName%" /bindings:"http://www.%NewDomainName%:%BackPort%":: %AppCmd% set SITE "www.%DomainName%" /bindings:"http://www.%NewDomainName%:%BackPort%,http://www.%NewDomainName%:%BackPort%"echo The execution is complete, please check the execution result...
pause