apang 发表于 2014-5-18 22:51
多谢!暂且弄成这样了
Office/Project/Visio 2010/2013的版本获取真麻烦,情况太多了:
32位Office/Project/Visio 2010/2013 安装在32位系统中
32位Office/Project/Visio 2010/2013 安装在64位系统中
64位Office/Project/Visio 2010/2013 安装在64位系统中
还有同时装了2010和2013版本....- @echo off
- title Microsoft Windows and Office Activate Helper
- setlocal enabledelayedexpansion
- :begin
- cls
- color 1F
- echo; -------=========Microsoft Windows and Office Activate Helper=========------
- echo;
- echo; THE FOLLOWING PRODUCTS CAN BE SUPPORTED:
- echo; Microsoft Windows Vista/7/8/8.1
- echo; Microsoft Windows Server 2008/2008R2/2012/2012R2
- echo; Microsoft Office/Project/Visio 2010/2013
- echo;
- echo; -------==========CURRENT OS OFFICE VISIO PROJECT VERSION==========---------
- echo;
- REM GET CURRENT OS VERSION
- IF EXIST "%PROGRAMFILES(X86)%" (set ARCH=64BIT) ELSE (set ARCH=32BIT)
- for /f "tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion"^|find /i "ProductName"') do (echo; %%B %ARCH%)
- REM GET CURRENT OFFICE VISIO PROJECT VERSION
- set "_00=32BIT Volume"
- set "_01=64BIT Volume"
- set "_10=32BIT Retail/OEM"
- set "_11=64BIT Retail/OEM"
- set "v=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
- set "re={9[01]140000-0012-0000-[01]000-0000000FF1CE}"
- (for /f "delims=" %%a in ('reg query "%v%" ^| findstr /ie %re%') do (
- for /f "tokens=2*" %%b in ('reg query "%%a" /v "DisplayName"') do (
- if /i "%%b" == "reg_sz" (
- set "var=%%~nxa"
- for %%d in ("!var:~2,1!!var:~20,1!") do echo; %%c !_%%~d!
- )
- )
- )) 2>nul
-
- set "re={9[01]140000-0011-0000-[01]000-0000000FF1CE}"
- (for /f "delims=" %%a in ('reg query "%v%" ^| findstr /ie %re%') do (
- for /f "tokens=2*" %%b in ('reg query "%%a" /v "DisplayName"') do (
- if /i "%%b" == "reg_sz" (
- set "var=%%~nxa"
- for %%d in ("!var:~2,1!!var:~20,1!") do echo; %%c !_%%~d!
- )
- )
- )) 2>nul
-
- set "re={9[01]140000-0053-0000-[01]000-0000000FF1CE}"
- (for /f "delims=" %%a in ('reg query "%v%" ^| findstr /ie %re%') do (
- for /f "tokens=2*" %%b in ('reg query "%%a" /v "DisplayName"') do (
- if /i "%%b" == "reg_sz" (
- set "var=%%~nxa"
- for %%d in ("!var:~2,1!!var:~20,1!") do echo; %%c !_%%~d!
- )
- )
- )) 2>nul
-
- set "re={9[01]140000-0057-0000-[01]000-0000000FF1CE}"
- (for /f "delims=" %%a in ('reg query "%v%" ^| findstr /ie %re%') do (
- for /f "tokens=2*" %%b in ('reg query "%%a" /v "DisplayName"') do (
- if /i "%%b" == "reg_sz" (
- set "var=%%~nxa"
- for %%d in ("!var:~2,1!!var:~20,1!") do echo; %%c !_%%~d!
- )
- )
- )) 2>nul
-
- set "re={9[01]140000-003A-0000-[01]000-0000000FF1CE}"
- (for /f "delims=" %%a in ('reg query "%v%" ^| findstr /ie %re%') do (
- for /f "tokens=2*" %%b in ('reg query "%%a" /v "DisplayName"') do (
- if /i "%%b" == "reg_sz" (
- set "var=%%~nxa"
- for %%d in ("!var:~2,1!!var:~20,1!") do echo; %%c !_%%~d!
- )
- )
- )) 2>nul
-
- set "re={9[01]140000-003B-0000-[01]000-0000000FF1CE}"
- (for /f "delims=" %%a in ('reg query "%v%" ^| findstr /ie %re%') do (
- for /f "tokens=2*" %%b in ('reg query "%%a" /v "DisplayName"') do (
- if /i "%%b" == "reg_sz" (
- set "var=%%~nxa"
- for %%d in ("!var:~2,1!!var:~20,1!") do echo; %%c !_%%~d!
- )
- )
- )) 2>nul
-
- set "re={9[01]150000-0012-0000-[01]000-0000000FF1CE}"
- (for /f "delims=" %%a in ('reg query "%v%" ^| findstr /ie %re%') do (
- for /f "tokens=2*" %%b in ('reg query "%%a" /v "DisplayName"') do (
- if /i "%%b" == "reg_sz" (
- set "var=%%~nxa"
- for %%d in ("!var:~2,1!!var:~20,1!") do echo; %%c !_%%~d!
- )
- )
- )) 2>nul
-
- set "re={9[01]150000-0011-0000-[01]000-0000000FF1CE}"
- (for /f "delims=" %%a in ('reg query "%v%" ^| findstr /ie %re%') do (
- for /f "tokens=2*" %%b in ('reg query "%%a" /v "DisplayName"') do (
- if /i "%%b" == "reg_sz" (
- set "var=%%~nxa"
- for %%d in ("!var:~2,1!!var:~20,1!") do echo; %%c !_%%~d!
- )
- )
- )) 2>nul
-
- set "re={9[01]150000-0053-0000-[01]000-0000000FF1CE}"
- (for /f "delims=" %%a in ('reg query "%v%" ^| findstr /ie %re%') do (
- for /f "tokens=2*" %%b in ('reg query "%%a" /v "DisplayName"') do (
- if /i "%%b" == "reg_sz" (
- set "var=%%~nxa"
- for %%d in ("!var:~2,1!!var:~20,1!") do echo; %%c !_%%~d!
- )
- )
- )) 2>nul
-
- set "re={9[01]150000-0051-0000-[01]000-0000000FF1CE}"
- (for /f "delims=" %%a in ('reg query "%v%" ^| findstr /ie %re%') do (
- for /f "tokens=2*" %%b in ('reg query "%%a" /v "DisplayName"') do (
- if /i "%%b" == "reg_sz" (
- set "var=%%~nxa"
- for %%d in ("!var:~2,1!!var:~20,1!") do echo; %%c !_%%~d!
- )
- )
- )) 2>nul
-
- set "re={9[01]150000-003A-0000-[01]000-0000000FF1CE}"
- (for /f "delims=" %%a in ('reg query "%v%" ^| findstr /ie %re%') do (
- for /f "tokens=2*" %%b in ('reg query "%%a" /v "DisplayName"') do (
- if /i "%%b" == "reg_sz" (
- set "var=%%~nxa"
- for %%d in ("!var:~2,1!!var:~20,1!") do echo; %%c !_%%~d!
- )
- )
- )) 2>nul
-
- set "re={9[01]150000-003B-0000-[01]000-0000000FF1CE}"
- (for /f "delims=" %%a in ('reg query "%v%" ^| findstr /ie %re%') do (
- for /f "tokens=2*" %%b in ('reg query "%%a" /v "DisplayName"') do (
- if /i "%%b" == "reg_sz" (
- set "var=%%~nxa"
- for %%d in ("!var:~2,1!!var:~20,1!") do echo; %%c !_%%~d!
- )
- )
- )) 2>nul
-
- set "v=HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
- set "re={9[01]140000-0012-0000-[01]000-0000000FF1CE}"
- (for /f "delims=" %%a in ('reg query "%v%" ^| findstr /ie %re%') do (
- for /f "tokens=2*" %%b in ('reg query "%%a" /v "DisplayName"') do (
- if /i "%%b" == "reg_sz" (
- set "var=%%~nxa"
- for %%d in ("!var:~2,1!!var:~20,1!") do echo; %%c !_%%~d!
- )
- )
- )) 2>nul
-
- set "re={9[01]140000-0011-0000-[01]000-0000000FF1CE}"
- (for /f "delims=" %%a in ('reg query "%v%" ^| findstr /ie %re%') do (
- for /f "tokens=2*" %%b in ('reg query "%%a" /v "DisplayName"') do (
- if /i "%%b" == "reg_sz" (
- set "var=%%~nxa"
- for %%d in ("!var:~2,1!!var:~20,1!") do echo; %%c !_%%~d!
- )
- )
- )) 2>nul
-
- set "re={9[01]140000-0053-0000-[01]000-0000000FF1CE}"
- (for /f "delims=" %%a in ('reg query "%v%" ^| findstr /ie %re%') do (
- for /f "tokens=2*" %%b in ('reg query "%%a" /v "DisplayName"') do (
- if /i "%%b" == "reg_sz" (
- set "var=%%~nxa"
- for %%d in ("!var:~2,1!!var:~20,1!") do echo; %%c !_%%~d!
- )
- )
- )) 2>nul
-
- set "re={9[01]140000-0057-0000-[01]000-0000000FF1CE}"
- (for /f "delims=" %%a in ('reg query "%v%" ^| findstr /ie %re%') do (
- for /f "tokens=2*" %%b in ('reg query "%%a" /v "DisplayName"') do (
- if /i "%%b" == "reg_sz" (
- set "var=%%~nxa"
- for %%d in ("!var:~2,1!!var:~20,1!") do echo; %%c !_%%~d!
- )
- )
- )) 2>nul
-
- set "re={9[01]140000-003A-0000-[01]000-0000000FF1CE}"
- (for /f "delims=" %%a in ('reg query "%v%" ^| findstr /ie %re%') do (
- for /f "tokens=2*" %%b in ('reg query "%%a" /v "DisplayName"') do (
- if /i "%%b" == "reg_sz" (
- set "var=%%~nxa"
- for %%d in ("!var:~2,1!!var:~20,1!") do echo; %%c !_%%~d!
- )
- )
- )) 2>nul
-
- set "re={9[01]140000-003B-0000-[01]000-0000000FF1CE}"
- (for /f "delims=" %%a in ('reg query "%v%" ^| findstr /ie %re%') do (
- for /f "tokens=2*" %%b in ('reg query "%%a" /v "DisplayName"') do (
- if /i "%%b" == "reg_sz" (
- set "var=%%~nxa"
- for %%d in ("!var:~2,1!!var:~20,1!") do echo; %%c !_%%~d!
- )
- )
- )) 2>nul
-
- set "re={9[01]150000-0012-0000-[01]000-0000000FF1CE}"
- (for /f "delims=" %%a in ('reg query "%v%" ^| findstr /ie %re%') do (
- for /f "tokens=2*" %%b in ('reg query "%%a" /v "DisplayName"') do (
- if /i "%%b" == "reg_sz" (
- set "var=%%~nxa"
- for %%d in ("!var:~2,1!!var:~20,1!") do echo; %%c !_%%~d!
- )
- )
- )) 2>nul
-
- set "re={9[01]150000-0011-0000-[01]000-0000000FF1CE}"
- (for /f "delims=" %%a in ('reg query "%v%" ^| findstr /ie %re%') do (
- for /f "tokens=2*" %%b in ('reg query "%%a" /v "DisplayName"') do (
- if /i "%%b" == "reg_sz" (
- set "var=%%~nxa"
- for %%d in ("!var:~2,1!!var:~20,1!") do echo; %%c !_%%~d!
- )
- )
- )) 2>nul
-
- set "re={9[01]150000-0053-0000-[01]000-0000000FF1CE}"
- (for /f "delims=" %%a in ('reg query "%v%" ^| findstr /ie %re%') do (
- for /f "tokens=2*" %%b in ('reg query "%%a" /v "DisplayName"') do (
- if /i "%%b" == "reg_sz" (
- set "var=%%~nxa"
- for %%d in ("!var:~2,1!!var:~20,1!") do echo; %%c !_%%~d!
- )
- )
- )) 2>nul
-
- set "re={9[01]150000-0051-0000-[01]000-0000000FF1CE}"
- (for /f "delims=" %%a in ('reg query "%v%" ^| findstr /ie %re%') do (
- for /f "tokens=2*" %%b in ('reg query "%%a" /v "DisplayName"') do (
- if /i "%%b" == "reg_sz" (
- set "var=%%~nxa"
- for %%d in ("!var:~2,1!!var:~20,1!") do echo; %%c !_%%~d!
- )
- )
- )) 2>nul
-
- set "re={9[01]150000-003A-0000-[01]000-0000000FF1CE}"
- (for /f "delims=" %%a in ('reg query "%v%" ^| findstr /ie %re%') do (
- for /f "tokens=2*" %%b in ('reg query "%%a" /v "DisplayName"') do (
- if /i "%%b" == "reg_sz" (
- set "var=%%~nxa"
- for %%d in ("!var:~2,1!!var:~20,1!") do echo; %%c !_%%~d!
- )
- )
- )) 2>nul
-
- set "re={9[01]150000-003B-0000-[01]000-0000000FF1CE}"
- (for /f "delims=" %%a in ('reg query "%v%" ^| findstr /ie %re%') do (
- for /f "tokens=2*" %%b in ('reg query "%%a" /v "DisplayName"') do (
- if /i "%%b" == "reg_sz" (
- set "var=%%~nxa"
- for %%d in ("!var:~2,1!!var:~20,1!") do echo; %%c !_%%~d!
- )
- )
- )) 2>nul
- echo; ---------=========================================================---------
- echo;
- echo; 1.Online Activate Microsoft Windows
- echo;
- echo; 2.Online Activate Microsoft Office
- echo;
- echo; 3.Offline Activate Microsoft Windows
- echo;
- echo; 4.Offline Activate Microsoft Office
- echo;
- set /p ans=PLEASE CHOOSE 1/2/3/4 AND PRESS ENTER TO CONTINUE:
- if "%ans%"=="1" goto onlinewindows
- if "%ans%"=="2" goto onlineoffice
- if "%ans%"=="3" goto offlinewindows
- if "%ans%"=="4" goto offlineoffice
- goto begin
- REM Online Activate Microsoft Windows
- :onlinewindows
- goto inputkey
-
- :inputkey
- cls
- set /p inputkey=PLEASE ENTER PRODUCT KEY LIKE XXXXX-XXXXX-XXXXX-XXXXX-XXXXX AND PRESS ENTER TO CONTINUE:
- cscript /nologo %windir%\system32\slmgr.vbs /ipk %inputkey% | findstr 成功地安装了产品密钥 >nul && goto ato || goto reenter
-
- :ato
- cls
- cscript /nologo %windir%\system32\slmgr.vbs /ato | findstr 成功地激活了产品 >nul && goto done || goto reenter
-
- :done
- cls
- echo;已成功激活
- timeout 5
- goto begin
-
- :reenter
- cls
- echo;密钥无效,请更换密钥重新输入
- timeout 5
- goto inputkey
-
- REM Offline Activate Microsoft Windows
- :offlinewindows
- goto inputkeyb
-
- :inputkeyb
- cls
- set /p inputkeyb=PLEASE ENTER PRODUCT KEY LIKE XXXXX-XXXXX-XXXXX-XXXXX-XXXXX AND PRESS ENTER TO CONTINUE:
- cscript /nologo %windir%\system32\slmgr.vbs /ipk %inputkeyb% | findstr 成功地安装了产品密钥 >nul && goto atob || goto reenter
-
- :atob
- cls
- echo;免费、无广告、无需注册、不限时间、不限流量VPN:http://tenacy-free.com/
- echo;
- echo;VPN使用教程:http://tenacy-free.com/tutorials/pptp-windows-8
- echo;
- echo;Skype下载:http://www.skype.com/go/getskype-msi
- echo;
- echo;英国电话号码:8000188354
- echo;
- echo;语音翻译:http://www.lenovo.me/wp-content/uploads/englishtochinese.txt
- echo;
- cscript /nologo %windir%\system32\slmgr.vbs /dti >dti.txt
- echo;安装ID(9组×7位,共63位)已保存在当前目录dti.txt文件中
- echo;
- echo;请挂VPN用Skype打英国电话,记下确认ID
- echo;
- echo; a.密钥无效(无法获得确认ID)
- echo;
- echo; b.密钥有效(已经获得确认ID)
- echo;
- set /p ab=请输入字母a or b后按Enter键继续:
- if "%ab%"=="a" goto inputkeyb
- if "%ab%"=="b" goto atoc
-
- :atoc
- cls
- set /p wcid=请输入确认ID(8组×6位,共48位,连续输入,不用输-):
- cscript /nologo %windir%\system32\slmgr.vbs /atp %wcid% | findstr /x "确认 ID 成功地存储" >nul && goto done || goto reenter
-
- REM Online Activate Microsoft Office
- :onlineoffice
- goto ipk
-
- :ipk
- cls
- set /p ipk=PLEASE ENTER PRODUCT KEY LIKE XXXXX-XXXXX-XXXXX-XXXXX-XXXXX AND PRESS ENTER TO CONTINUE:
- (for /f "tokens=2*" %%i in ('reg query "HKLM\SOFTWARE\Microsoft\Office\14.0\Common\InstallRoot"^| find /i "Path"') do (set installroot=%%j))2>nul
- (for /f "tokens=2*" %%i in ('reg query "HKLM\SOFTWARE\Microsoft\Office\15.0\Common\InstallRoot"^| find /i "Path"') do (set installroot=%%j))2>nul
- (for /f "tokens=2*" %%i in ('reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\14.0\Common\InstallRoot"^| find /i "Path"') do (set installroot=%%j))2>nul
- (for /f "tokens=2*" %%i in ('reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\15.0\Common\InstallRoot"^| find /i "Path"') do (set installroot=%%j))2>nul
- cscript "%installroot%\ospp.vbs" /inpkey:%ipk% | findstr /x "<Product key installation successful>" >nul && goto act || goto reenterb
-
- :act
- (for /f "tokens=2*" %%i in ('reg query "HKLM\SOFTWARE\Microsoft\Office\14.0\Common\InstallRoot"^| find /i "Path"') do (set installroot=%%j))2>nul
- (for /f "tokens=2*" %%i in ('reg query "HKLM\SOFTWARE\Microsoft\Office\15.0\Common\InstallRoot"^| find /i "Path"') do (set installroot=%%j))2>nul
- (for /f "tokens=2*" %%i in ('reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\14.0\Common\InstallRoot"^| find /i "Path"') do (set installroot=%%j))2>nul
- (for /f "tokens=2*" %%i in ('reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\15.0\Common\InstallRoot"^| find /i "Path"') do (set installroot=%%j))2>nul
- cscript "%installroot%\ospp.vbs" /act | findstr /x "<Product activation successful>" >nul && goto done || goto reenterb
-
- :reenterb
- cls
- echo;密钥无效,请更换密钥重新输入
- timeout 5
- goto ipk
-
- REM Offline Activate Microsoft Office
- :offlineoffice
- goto ipkb
-
- :ipkb
- cls
- set /p ipk=PLEASE ENTER PRODUCT KEY LIKE XXXXX-XXXXX-XXXXX-XXXXX-XXXXX AND PRESS ENTER TO CONTINUE:
- (for /f "tokens=2*" %%i in ('reg query "HKLM\SOFTWARE\Microsoft\Office\14.0\Common\InstallRoot"^| find /i "Path"') do (set installroot=%%j))2>nul
- (for /f "tokens=2*" %%i in ('reg query "HKLM\SOFTWARE\Microsoft\Office\15.0\Common\InstallRoot"^| find /i "Path"') do (set installroot=%%j))2>nul
- (for /f "tokens=2*" %%i in ('reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\14.0\Common\InstallRoot"^| find /i "Path"') do (set installroot=%%j))2>nul
- (for /f "tokens=2*" %%i in ('reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\15.0\Common\InstallRoot"^| find /i "Path"') do (set installroot=%%j))2>nul
- cscript "%installroot%\ospp.vbs" /inpkey:%ipk% | findstr /x "<Product key installation successful>" >nul && goto actb || goto reenterb
-
- :actb
- cls
- echo;免费、无广告、无需注册、不限时间、不限流量VPN:http://tenacy-free.com/
- echo;
- echo;VPN使用教程:http://tenacy-free.com/tutorials/pptp-windows-8
- echo;
- echo;Skype下载:http://www.skype.com/go/getskype-msi
- echo;
- echo;英国电话号码:8000188354
- echo;
- echo;语音翻译:http://www.lenovo.me/wp-content/uploads/englishtochinese.txt
- echo;
- (for /f "tokens=2*" %%i in ('reg query "HKLM\SOFTWARE\Microsoft\Office\14.0\Common\InstallRoot"^| find /i "Path"') do (set installroot=%%j))2>nul
- (for /f "tokens=2*" %%i in ('reg query "HKLM\SOFTWARE\Microsoft\Office\15.0\Common\InstallRoot"^| find /i "Path"') do (set installroot=%%j))2>nul
- (for /f "tokens=2*" %%i in ('reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\14.0\Common\InstallRoot"^| find /i "Path"') do (set installroot=%%j))2>nul
- (for /f "tokens=2*" %%i in ('reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\15.0\Common\InstallRoot"^| find /i "Path"') do (set installroot=%%j))2>nul
- cscript "%installroot%\ospp.vbs" /dinstid >dinstid.txt
- echo;安装ID(9组×7位,共63位)已保存在当前目录dinstid.txt文件中
- echo;
- echo;请挂VPN用Skype打英国电话,记下确认ID
- echo;
- echo; a.密钥无效(无法获得确认ID)
- echo;
- echo; b.密钥有效(已经获得确认ID)
- echo;
- set /p ab=请输入字母a or b后按Enter键继续:
- if "%ab%"=="a" goto ipkb
- if "%ab%"=="b" goto actc
-
- :actc
- cls
- set /p ocid=请输入确认ID(8组×6位,共48位,连续输入,不用输-):
- (for /f "tokens=2*" %%i in ('reg query "HKLM\SOFTWARE\Microsoft\Office\14.0\Common\InstallRoot"^| find /i "Path"') do (set installroot=%%j))2>nul
- (for /f "tokens=2*" %%i in ('reg query "HKLM\SOFTWARE\Microsoft\Office\15.0\Common\InstallRoot"^| find /i "Path"') do (set installroot=%%j))2>nul
- (for /f "tokens=2*" %%i in ('reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\14.0\Common\InstallRoot"^| find /i "Path"') do (set installroot=%%j))2>nul
- (for /f "tokens=2*" %%i in ('reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\15.0\Common\InstallRoot"^| find /i "Path"') do (set installroot=%%j))2>nul
- cscript "%installroot%\ospp.vbs" /actcid:%ocid% | findstr /x "<Offline product activation successful>" >nul && goto done || goto reenterb
复制代码
|