|
本帖最后由 hlowld 于 2023-10-11 09:43 编辑
支持一个,借楼发一个在chatgpt辅助下写的检测已安装的.net版本的批处理,就是查注册表,肯定不如asoft .net version detector严谨,但胜在简单,够用就好。
@echo off
setlocal enabledelayedexpansion
echo 已安装的.net版本
echo.
set "parentkey=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP"
reg query "%parentkey%" 1>nul 2>nul
if %errorlevel% equ 0 (
set "v4value="
for /f "tokens=1-6,* delims=\" %%a in ('reg query "%parentkey%"') do (
set "name=%%f"
set "key=%%a\%%b\%%c\%%d\%%e\%%f"
set /a found = 0
for /f "tokens=1,3,* delims= " %%g in ('reg query "!key!" /s ^| findstr /i "Version"') do (
if "%%g" == "Version" (
if !found! == 0 (
set /a found = 1
if !name! == v4 ( set "v4value=v4+ ------ %%h" ) else (echo !name:~,4! ------ %%h )
)
)
)
)
echo !v4value!
)
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" ( set "parentkey=HKEY_LOCAL_MACHINE\SOFTWARE\dotnet\Setup\InstalledVersions\x64\sharedhost" ) else ( set "parentkey=HKEY_LOCAL_MACHINE\SOFTWARE\dotnet\Setup\InstalledVersions\x86\sharedhost" )
reg query "%parentkey%" 1>nul 2>nul
if %errorlevel% equ 0 (
for /f "tokens=2,*" %%i in ('reg query "%parentkey%" /v "Version"') do (
echo new ------ %%j
)
)
echo.
pause
exit
|
|