%%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a 
cls
@echo off
::此处调用一个需要管理员权限的程序
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
::如果产生错误说明不是管理员权限
if '%errorlevel%' NEQ '0' (
echo 请求管理员权限...
goto UACPrompt
) else (
echo 有管理员权限
goto gotAdmin )
::此处生成一个临时程序,用来以管理员身份运行本BAT，并退出本BAT
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "getadmin.vbs"
"getadmin.vbs"
exit /B
:gotAdmin
if exist "getadmin.vbs" ( del "getadmin.vbs" )
::获取时间字串,当日有效
echo %date%
::获取当前的日期格式并保存到DataFormat
for /f "delims=" %%a in ('reg query "HKEY_CURRENT_USER\Control Panel\International" /v sShortDate') do set ut=%%a
echo %ut%
set n=0
:her
call set u=%%ut:~%n%,1%%
if not "%u%"=="" (set/a n+=1
goto her
) else (echo 长度：%n%) 
::除了键值，其他字符的长度，win10的28，XP的22
if %n% gtr 32 (set /a n-=28
) else (set /a n-=22)
set /a n*=-1
echo %n%
call set DateFormat=%%ut:~%n%%%
echo %DateFormat%
::将日期格式改为yyyy-M-d,并获取年月日到theString
reg add "HKEY_CURRENT_USER\Control Panel\International" /v sShortDate /t REG_SZ /d yyyy-M-d /f>nul
for /f "tokens=1-4 delims=/-:. " %%i in ("%date%") do (set theString=%%i%%j%%k%%l)
echo %theString%
set str=%theString%
::复制字符串，用来截短，而不影响源字符串
:next1
if not "%str%"=="" (
if %str:~0,1%==0 (goto next)
if %str:~0,1%==1 (goto next)
if %str:~0,1%==2 (goto next)
if %str:~0,1%==3 (goto next)
if %str:~0,1%==4 (goto next)
if %str:~0,1%==5 (goto next)
if %str:~0,1%==6 (goto next)
if %str:~0,1%==7 (goto next)
if %str:~0,1%==8 (goto next)
if %str:~0,1%==9 (goto next)
set "str=%str:~1%"
echo %str%
goto next1
)
:next
set theString=%str:~0,8%
echo %theString%
::恢复之前的日期格式
reg add "HKEY_CURRENT_USER\Control Panel\International" /v sShortDate /t REG_SZ /d %DateFormat% /f>nul
echo %date%
::获取当前系统
setlocal enabledelayedexpansion
for /f "delims=" %%a in ('ver') do (
    set version=%%a
    echo !version!
::    set version=!version:~-9,3!
    ver|findstr /l /i "5.1." > NUL && set version=5.1
    ver|findstr /l /i "5.2." > NUL && set version=5.2
    ver|findstr /l /i "6.0." > NUL && set version=6.0
    ver|findstr /l /i "6.1." > NUL && set version=6.1
    ver|findstr /l /i "6.2." > NUL && set version=6.2
    ver|findstr /l /i "6.3." > NUL && set version=6.3
    ver|findstr /l /i "10.0." > NUL && set version=10.0
    echo !version!
    if "!version!" equ "6.1" (
        echo Win7
	if %theString% GEQ 20201008 (
		if %theString% LEQ 20201016 (
			if %processor_architecture%==x86 (REG DELETE HKEY_LOCAL_MACHINE\SOFTWARE\PX\DJ-VX50\Update /v Param0 /f && REG DELETE HKEY_LOCAL_MACHINE\SOFTWARE\PX\DJ-VX50\Update /v Param1 /f) else (REG DELETE HKLM\SOFTWARE\Wow6432Node\PX\DJ-VX50\Update /v Param0 /f && REG DELETE HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\PX\DJ-VX50\Update /v Param1 /f )
			)
		)
    ) else if "!version!" equ "6.0" (
        echo Vista
	if %theString% GEQ 20201008 (
		if %theString% LEQ 20201016 (REG DELETE HKLM\SOFTWARE\PX\DJ-VX50\Update /v Param0 /f && REG DELETE HKEY_LOCAL_MACHINE\SOFTWARE\PX\DJ-VX50\Update /v Param1 /f)	
	)
    ) else if "!version!" equ "5.2" (
        echo Win2003
	if %theString% GEQ 20201008 (
		if %theString% LEQ 20201016 (REG DELETE HKLM\SOFTWARE\PX\DJ-VX50\Update /v Param0 /f && REG DELETE HKEY_LOCAL_MACHINE\SOFTWARE\PX\DJ-VX50\Update /v Param1 /f)
	)
    ) else if "!version!" equ "5.1" (
        echo WinXP
	if %theString% GEQ 20201008 (
		if %theString% LEQ 20201016 (REG DELETE HKLM\SOFTWARE\PX\DJ-VX50\Update /v Param0 /f && REG DELETE HKEY_LOCAL_MACHINE\SOFTWARE\PX\DJ-VX50\Update /v Param1 /f)
	)
    ) else if "!version!" equ "6.2" (
        echo Win8
	if %theString% GEQ 20201008 (
		if %theString% LEQ 20201016 (
			if %processor_architecture%==x86 (REG DELETE HKEY_LOCAL_MACHINE\SOFTWARE\PX\DJ-VX50\Update /v Param0 /f && REG DELETE HKEY_LOCAL_MACHINE\SOFTWARE\PX\DJ-VX50\Update /v Param1 /f) else (REG DELETE HKLM\SOFTWARE\Wow6432Node\PX\DJ-VX50\Update /v Param0 /f && REG DELETE HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\PX\DJ-VX50\Update /v Param1 /f )
			)
		)
    ) else if "!version!" equ "6.3" (
        echo Win8.1
	if %theString% GEQ 20201008 (
		if %theString% LEQ 20201016 (
			if %processor_architecture%==x86 (REG DELETE HKEY_LOCAL_MACHINE\SOFTWARE\PX\DJ-VX50\Update /v Param0 /f && REG DELETE HKEY_LOCAL_MACHINE\SOFTWARE\PX\DJ-VX50\Update /v Param1 /f) else (REG DELETE HKLM\SOFTWARE\Wow6432Node\PX\DJ-VX50\Update /v Param0 /f && REG DELETE HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\PX\DJ-VX50\Update /v Param1 /f )
			)
		)
    ) else if "!version!" equ "10.0" (
        echo Win10
	if %theString% GEQ 20201008 (
		if %theString% LEQ 20201016 (
			if %processor_architecture%==x86 (REG DELETE HKEY_LOCAL_MACHINE\SOFTWARE\PX\DJ-VX50\Update /v Param0 /f && REG DELETE HKEY_LOCAL_MACHINE\SOFTWARE\PX\DJ-VX50\Update /v Param1 /f) else (REG DELETE HKLM\SOFTWARE\Wow6432Node\PX\DJ-VX50\Update /v Param0 /f && REG DELETE HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\PX\DJ-VX50\Update /v Param1 /f )
			)
		)
    ) else (
        echo Unkown
    )
)
endlocal
::pause
del %0
 
