迷路轮回专用IIS兼容性修改

下面的代码,保存为批处理脚本运行即可。

运行一次修改为windows 7 兼容性设置,再运行一次即可修改为windows 10 兼容性设置。运行界面如下图:

@echo off
setlocal enabledelayedexpansion
title 迷路轮回专用IIS兼容性修改
mode con cols=80 lines=22
set "soft="


rem 判断系统是否高于XP
set "ban=0"
ver | find "6." > NUL && set "ban=6"
ver | find "10." > NUL && set "ban=10"
if %ban% LSS 6 goto start
rem 判断是否有权限
set uac=0 & bcdedit >nul & if errorlevel 1 set uac=1
if %uac%==0 (GOTO start) ELSE (goto :Error_UAC)
rem 开始获取管理员权限
:Error_UAC
%1 %2
mshta vbscript:createobject("shell.application").shellexecute("%~s0","goto :start","","runas",1)(window.close)&exit
rem 当得到管理员权限时的操作
:start
call :OS& call :IIS
set "aa=!value:0x=!"& call :chan !aa!
for /l %%i in (6,-1,1) do ( call :Main
if %%i==6 (call :echo)
if %%i==5 (call :chang)
if %%i==4 (if "soft"=="" start "" !soft!))
if %%i LSS 4 echo=谢谢使用,%%i秒后自动退出!
choice /t 1 /d y /n >nul )
exit
:chang
reg add HKLM\SYSTEM\CurrentControlSet\Services\W3SVC\Parameters /v MajorVersion /t REG_DWORD /d !vers! /f
call :IIS & set "aa=!value:0x=!"& call :chan !aa! & goto :eof
:echo
if !var!==7 ( set vers=10& echo=按下任意键,将修改兼容性为windows 10
					) else (
					if !var!==10 ( 
										set vers=7& echo=按下任意键,将修改兼容性为windows 7
										) else ( 
													call :IIS & echo=!value! 
													)
								)
					)
pause >nul& goto :eof
:OS
for /f "skip=1 tokens=1*" %%a in ('wmic os get caption') do (set os=%%b)& goto :eof
:IIS
for /f "tokens=2*" %%i in (
'reg query HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC\Parameters^|findstr MajorVersion'
) do set "value=%%j"& goto :eof
:chan ::十六进制转换为10进制
set "var="& for /f "delims=" %%i in ("%1") do (
    set str=%%i
    set Ln=&set "Sn=!str!"
    for %%j in (16)do if "!Sn:~%%j!" NEQ "" set/aLn+=%%j&set Sn=!Sn:~%%j!
    set Sn=!Sn!FEDCBA9876543210&set/aLn+=0x!Sn:~16,1!
    for /l %%j in (0 2 !Ln!) do (
        set /a "D=0x!str:~%%j,2!"
        set var=!var!!D!
    )
)
goto :eof
:Main
cls & echo= & echo= & echo=
echo=			    迷路轮回专用IIS兼容性修改工具
echo= & echo=
echo  ==============================================================================
echo= & echo=& echo= 	当前操作系统为:!os!
echo=& echo= 	注册表中的IIS版本为:!var!(即兼容性为windows !var!)
echo= & echo=& echo= 				        迷路轮回 2017-02-09 www.xyx115.com
echo  ==============================================================================
set /p=				        <nul& goto :eof
0 0 vote
Article Rating
1 评论
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
trackback

[…] 批处理代码也可以完成此任务。效果完全一样。参见:http://xyx115.com/?p=785 […]

Scroll to Top