1 @echo off 2 3 echo ------------------------------------------------------------------------------ 4 echo -----------------------修改IIS虚拟目录名称------------------------------------ 5 echo ------------------------------------------------------------------------------ 6 7 cd %systemroot%system32inetsrv 8 9 echo. 10 echo 请输入完整虚拟站点路径,站点名称+虚拟目录名称(例:Default Web Site/test) 11 set /p virthPath= 12 13 rem echo %virthPath% 14 15 echo. 16 echo 请输入虚拟站点新名称,直接输入名称,不需要指定在哪个站点下!(例:testNew) 17 set /p NewPath= 18 19 rem echo %NewPath% 20 21 echo. 22 echo 确认修改吗?请确认输入无误,程序将执行 appcmd set app "%virthPath%" -path:/%NewPath% 23 set /p y=1 or 0: 24 25 rem echo %y% 26 echo. 27 if '%y%'=='1' ( 28 appcmd set app "%virthPath%" -path:/%NewPath% 29 ) 30 31 rem appcmd set app "Default Web Site/tianmashop" -path:/tianmashopNew 32 33 echo. 34 echo 如果执行成功,请刷新IIS看效果。 35 echo. 36 37 pause
执行效果:
转自:https://www.cnblogs.com/lizhanglong/p/6224924.html