下了个批处理,,帮忙分析一下
- 提问者网友:椧運幽默
- 2021-08-22 00:28
@ECHO OFFtitle Install Office 2010 Activation Info Backup Tools-www.fosoyo.comcolor fcclsecho.echo.echo (c) www.fosoyo.comecho.echo.
ECHO C.Backup Office 2010ECHO D.Restore Office 2010echo.SET Choice=SET /P Choice= Please Select Option[Enter 'C' or 'D']:ECHO.IF NOT '%Choice%'=='' SET Choice=%Choice:~0,1%
IF /I '%Choice%'=='C' Goto BackupOfficeIF /I '%Choice%'=='D' Goto RestoreOffice
:BackupOffice
Copy "%PROGRAMFILES%\Common Files\Microsoft Shared\OFFICE14\Office Setup Controller\pkeyconfig-office.xrm-ms" /-Y
Copy "%PROGRAMFILES(x86)%\Common Files\Microsoft Shared\OFFICE14\Office Setup Controller\pkeyconfig-office.xrm-ms" /-Y
Copy %ALLUSERSPROFILE%\Microsoft\OfficeSoftwareProtectionPlatform\tokens.dat /-Y
echo.echo Activation Info Backup completed.
Goto End
:RestoreOffice
net stop osppsvc
takeown /f "%PROGRAMFILES%\Common Files\Microsoft Shared\OFFICE14\Office Setup Controller\pkeyconfig-office.xrm-ms"icacls "%PROGRAMFILES%\Common Files\Microsoft Shared\OFFICE14\Office Setup Controller\pkeyconfig-office.xrm-ms" /grant administrators:F /tdel /F /Q "%PROGRAMFILES%\Common Files\Microsoft Shared\OFFICE14\Office Setup Controller\pkeyconfig-office.xrm-ms"copy "%~dp0pkeyconfig-office.xrm-ms" "%PROGRAMFILES%\Common Files\Microsoft Shared\OFFICE14\Office Setup Controller\pkeyconfig-office.xrm-ms"
takeown /f "%PROGRAMFILES(x86)%\Common Files\Microsoft Shared\OFFICE14\Office Setup Controller\pkeyconfig-office.xrm-ms"icacls "%PROGRAMFILES(x86)%\Common Files\Microsoft Shared\OFFICE14\Office Setup Controller\pkeyconfig-office.xrm-ms" /grant administrators:F /tdel /F /Q "%PROGRAMFILES(x86)%\Common Files\Microsoft Shared\OFFICE14\Office Setup Controller\pkeyconfig-office.xrm-ms"copy "%~dp0pkeyconfig-office.xrm-ms" "%PROGRAMFILES(x86)%\Common Files\Microsoft Shared\OFFICE14\Office Setup Controller\pkeyconfig-office.xrm-ms"
takeown /f "%ALLUSERSPROFILE%\Microsoft\OfficeSoftwareProtectionPlatform\tokens.dat"icacls "%ALLUSERSPROFILE%\Microsoft\OfficeSoftwareProtectionPlatform\tokens.dat" /grant administrators:F /tdel /F /Q "%ALLUSERSPROFILE%\Microsoft\OfficeSoftwareProtectionPlatform\tokens.dat"copy "%~dp0tokens.dat" "%ALLUSERSPROFILE%\Microsoft\OfficeSoftwareProtectionPlatform\tokens.dat"
takeown /f "%ALLUSERSPROFILE%\Microsoft\OfficeSoftwareProtectionPlatform\Cache" /ricacls "%ALLUSERSPROFILE%\Microsoft\OfficeSoftwareProtectionPlatform\Cache" /grant administrators:F /trd /s /Q "%ALLUSERSPROFILE%\Microsoft\OfficeSoftwareProtectionPlatform\Cache"net start osppsvccscript "%ProgramFiles%\Microsoft Office\Office14\ospp.vbs" /dstatuscscript "%ProgramFiles(x86)%\Microsoft Office\Office14\ospp.vbs" /dstatus
echo.echo Activation Info Restore completed.
:End
Pause>nul
- 五星知识达人网友:第四晚心情
- 2021-08-22 01:46
- 1楼网友:舍身薄凉客
- 2021-08-22 04:22
echo. 实际效果是 空行
SET Choice= ::设置变量Choice SET /P Choice= Please Select Option[Enter 'C' or 'D']: ::SET /P variable=[promptString] /P 命令行开关允许将变量数值设成用户输入的一行输入。读取输入行之前,显示指定promptString
。promptString就是提示语句。 显示Please Select Option[Enter 'C' or 'D']:并把输入值赋给Choice ECHO.
IF NOT '%Choice%'=='' SET Choice=%Choice:~0,1% :: SET Choice=%Choice:~0,1% 提取 Choice 变量的所有字符,除了第一个。 IF /I '%Choice%'=='C' Goto BackupOffice
IF /I '%Choice%'=='D' Goto RestoreOffice
net stop osppsvc ::停止osppsvc服务,osppsvc是验证office激活状态的服务
takeown /f "%ALLUSERSPROFILE%\Microsoft\OfficeSoftwareProtectionPlatform\tokens.dat"
::takeown /f 指定文件名或目录名模式,指定了路径"%ALLUSERSPROFILE%\Microsoft\OfficeSoftwareProtectionPlatform\tokens.dat"并成为文件拥有者
cacls "%ALLUSERSPROFILE%\Microsoft\OfficeSoftwareProtectionPlatform\tokens.dat" /grant administrators:F /t
::cacls /grant 赋予指定用户administrators访问权限 /t 更改当前目录及其所有子目录中指定访问控制列表
del /F /Q "%ALLUSERSPROFILE%\Microsoft\OfficeSoftwareProtectionPlatform\tokens.dat"
copy "%~dp0tokens.dat" "%ALLUSERSPROFILE\Microsoft\OfficeSoftwareProtectionPlatform\tokens.dat"
takeown /f "%ALLUSERSPROFILE%\Microsoft\OfficeSoftwareProtectionPlatform\Cache" /ricacls "%ALLUSERSPROFILE%\Microsoft\OfficeSoftwareProtectionPlatform\Cache" /grant administrators:F /t
rd /s /Q "%ALLUSERSPROFILE%\Microsoft\OfficeSoftwareProtectionPlatform\Cache"
net start osppsvccscript "%ProgramFiles%\Microsoft Office\Office14\ospp.vbs" /dstatuscscript "%ProgramFiles(x86)%\Microsoft Office\Office14\ospp.vbs" /dstatus
下面那一段命令被我肢解了,你应该能看懂了吧?
- 2楼网友:走死在岁月里
- 2021-08-22 03:22
我给你写好了,到这里下载完整文件.
http://chnhk.hasfiles.com/web/temp/backup.rar
或是
http://chnhk.hasfiles.com/web/temp/backup.bat