|
8#
楼主 |
发表于 2007-2-26 23:19:17
|
只看该作者
痛苦。好不容易才弄好。
现把批处理程序贴出,请各位大大特别是namejm和老毛桃两位高人指正。
程序功能为确定正在运行的Windows Vista版本。
程序1(直接读取注册表版本,速度快,不过由于注册表可能被修改,可能不准确)
@echo off
for /f "tokens=6,7" %%i in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ProductName^|find /i "ProductName"') do set os1=%%i && set os2=%%j
set VH="Home "
set VB="Business"
set VU="Ultimate"
set PR="Premium"
set BA="Basic"
if %os1% == %VH:~1,4% goto home
if %os1% == %VB:~1,8% goto business
if %os1% == %VU:~1,8% goto Ultimate
goto err
:home
if %os2% == %PR:~1,7% echo "This is Windows Vista Home Premium."
if %os2% == %BA:~1,5% echo "This is Windows Vista Home Basic."
goto end
:business
echo "This is Windows Vista Business."
goto end
:ultimate
echo "This is Windows Vista Ultimate."
goto end
:err
echo "Don't know this system."
:end
pause
程序2(通过systeminfo读取信息)
@echo off
for /f "tokens=6,7" %%i in ('systeminfo ^|find "OS 名称:"') do set os1=%%i && set os2=%%j
set VH="Home "
set VB="Business"
set VU="Ultimate"
set PR="Premium"
set BA="Basic"
if %os1% == %VH:~1,4% goto home
if %os1% == %VB:~1,8% goto business
if %os1% == %VU:~1,8% goto Ultimate
goto err
:home
if %os2% == %PR:~1,7% echo "This is Windows Vista Home Premium."
if %os2% == %BA:~1,5% echo "This is Windows Vista Home Basic."
goto end
:business
echo "This is Windows Vista Business."
goto end
:ultimate
echo "This is Windows Vista Ultimate."
goto end
:err
echo "Don't know this system."
:end
pause |
|