for /f "tokens=2 delims=[]" %%Q in ('ver') do for /f "tokens=2-4 delims=. " %%R in ("%%Q") do set "ver=%%R%%S"&set "verbuild=%%T"
::获取显示版本名称,例如22H2、21H2、20H2、2004、1909、1903等
for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "DisplayVersion" 2^>nul') do set "displayversion=%%a"