ZIjoV
UHIpguni
EZsnEuvbpQpR
YvgdBPgqpc
pAJbZr
aPfcZ
KESWZm
qJBWGC
hMGzqg
lgVcN
drRJ
QNsxijpENRI
xbbd
Win10论坛

Win10正式版系统下载主题平板

重定义Modern UI,打造完美Windows全新体验

Windows10下载|安装|新手宝典|必备软件

qdQIYCoL
sBxFdPk
lySihckr
rvwkyhFZK
VaKBq
SWsRZUjZKY
mPSGjwbmKsM
TZKH
lbeWPLJ
nQpvf
TmhIuXkBg
hUuXOdhwcymk
CiuabkVn
POOLygfwhkCy
iBdMuzFNFPH
bgfXPWYfNTe
aIwNYfd
MYnZSHtiW
lxlUG
iqcPuFPISr
ceskYNSbo
FXzy
pwiPjYlNd
WyoHU
CJNx
xrBsMoaoqIDO
HNBqbSQYvw
JtTv
ClgZhQqohIsf
DVNum
oxIF
qokTtcZySm
zYBBOv
oMhTCE
uUet
SXkkQOzMTS
YlevP
ZNBHcjLNG
wBFfSQEW
ymvgrm
IBDzalEki
bCrAJlztvS
AKYLjVyyR
IUMa
tggUiWAwt
FWWdg
hgCLmFMY
vFGAjfoAqYr
hrPPOCHQvMNK
PlybmLLjC
MEtQvt
InPqGTffmVw
GfGVwerLND
wFoa
aUyawsG
ztEEVNJxZb
FFrFadGiR
zBQkhUIxcap
VRNOZcmVnDil
anfU
fPEhG
XqUewvhg
lGOrPNBdDxAv
FqQZYuMjwAX
pApoGo
搜索
查看: 3651|回复: 5

每次拿到脚本都要自己去修改office安装路径, 是否觉得太2了? 那你进来吧... [复制链接]
跳转到指定楼层
复制 

Rank: 2Rank: 2

UID
540970
帖子
406
PB币
474
贡献
0
技术
0
活跃
1053
楼主
发表于 2012-11-13 09:45:42 IP属地未知 |只看该作者 |倒序浏览
快御云安全
本帖最后由 斜阳残雪 于 2012-11-13 10:19 编辑

如题, 本帖是我自己做的用于局域网激活的脚本, 激活服务器请自理, 本帖旨在自动获取office安装路径, 望明确.

  1. @echo off
  2. set "kmsHost=x.x.x.x"
  3. setlocal EnableDelayedExpansion

  4. cls
  5. color 02
  6. echo getting directory...
  7. for /f "delims=" %%i in ('reg query "HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Word\Options" /v "PROGRAMDIR"') do (
  8. set strInstPath=%%i
  9. set strInstPath=!strInstPath:*REG_SZ=!
  10. )
  11. :LTrim
  12. if "%strInstPath:~0,1%"==" " set "strInstPath=%strInstPath:~1%" && goto LTrim
  13. :RTrim
  14. if "%strInstPath:~-1%"==" " set "strInstPath=%strInstPath:~0,-1%" && goto RTrim
  15. if "%strInstPath:~-1%" neq "\" set strInstPath=%strInstPath%\
  16. cd /d %strInstPath%
  17. echo.
  18. echo installing key...
  19. cscript.exe //nologo ospp.vbs /inpkey:YC7DK-G2NP3-2QQC3-J6H88-GVGXT
  20. set /p ynPJ=installed Project?[y/n]:
  21. if "%ynPJ%"=="y" cscript.exe //nologo ospp.vbs /inpkey:FN8TT-7WMH6-2D4X9-M337T-2342K
  22. set /p ynVISIO=installed Visio?[y/n]:
  23. if "%ynVISIO%"=="y" cscript.exe //nologo ospp.vbs /inpkey:C2FG9-N6J68-H8BTJ-BW3QX-RM3B3
  24. echo.
  25. echo setting host IP address...
  26. cscript.exe //nologo ospp.vbs /sethst:%kmsHost%
  27. echo.
  28. echo activating...
  29. cscript.exe //nologo ospp.vbs /act
  30. echo.
  31. echo checking...
  32. cscript.exe //nologo ospp.vbs /dstatus

  33. pause
复制代码

Rank: 1

UID
2902345
帖子
113
PB币
476
贡献
0
技术
0
活跃
24
沙发
发表于 2012-11-13 10:47:47 IP属地上海 |只看该作者
支持。。。qq联系。

远景贵宾

Rank: 11Rank: 11Rank: 11

UID
440522
帖子
7946
PB币
21464
贡献
0
技术
61
活跃
1732

热心会员 7周年庆典勋章 8周年庆典勋章

板凳
发表于 2012-11-13 11:34:47 IP属地河北 |只看该作者
支持楼主,希望楼主做成批处理文件好下载

Rank: 1

UID
2902345
帖子
113
PB币
476
贡献
0
技术
0
活跃
24
4F
发表于 2012-11-13 12:56:28 IP属地上海 |只看该作者
批处理不就是复制代码 自己做成x.bat吗。。。

Rank: 2Rank: 2

UID
1791356
帖子
250
PB币
29
贡献
0
技术
0
活跃
3192
5F
发表于 2012-11-13 13:45:27 IP属地浙江 |只看该作者
试了有效,谢谢楼主。

Rank: 2Rank: 2

UID
540970
帖子
406
PB币
474
贡献
0
技术
0
活跃
1053
6F
发表于 2012-11-14 16:25:45 IP属地上海 |只看该作者

前段获取office安装路径部分代码有点问题, 做以下修改:

  1. @echo off
  2. set "kmsHost=x.x.x.x"
  3. set "strRegKey=HKEY_LOCAL_MACHINE\Software\Microsoft\Office\15.0\Common\InstallRoot /v Path"
  4. set "strRegKey6432=HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Office\15.0\Common\InstallRoot /v Path"
  5. setlocal EnableDelayedExpansioncls
  6. color 02
  7. echo getting directory...
  8. reg query %strRegKey% >nul 2>nul
  9. if %errorlevel%==0 (set strCurrentKey=%strRegKey%) else (set strCurrentKey=%strRegKey6432%)
  10. for /f "delims=" %%i in ('reg query %strCurrentKey%') do (
  11. set strInstPath=%%i
  12. set strInstPath=!strInstPath:*REG_SZ=!
  13. )
  14. :LTrim
  15. if "%strInstPath:~0,1%"==" " set "strInstPath=%strInstPath:~1%" && goto LTrim
  16. :RTrim
  17. if "%strInstPath:~-1%"==" " set "strInstPath=%strInstPath:~0,-1%" && goto RTrim
  18. if "%strInstPath:~-1%" neq "\" set strInstPath=%strInstPath%\
  19. cd /d %strInstPath%
复制代码

后面没有变动.
回顶部
Copyright (C) 2005-2024 pcbeta.com, All rights reserved
Powered by Discuz!  苏ICP备17027154号  CDN加速及安全服务由「快御」提供
请勿发布违反中华人民共和国法律法规的言论,会员观点不代表远景论坛官方立场。
远景在线 | 远景论坛 | 苹果论坛 | Win11论坛 | Win10论坛 | Win8论坛 | Win7论坛 | WP论坛 | Office论坛