永遠的測試版。想要實作一下,結果花了三天才寫好。
參考來源:
How to Open .HLP WinHelp Files in Windows 10
Восстановление winhlp32.exe в Windows 10
Windows 10で古いヘルプファイル(*.hlp)が開けないときに
Windows10用WinHlp32.exeインストールバッチファイル
語法:
@echo on & cd /d %~dp0 & set ele=ele.%processor_architecture%
(ele.%processor_architew6432% "%~f0" && exit /b || net.exe file || openfiles.exe || %ele% "%~f0" && exit /b || exit /b) >nul 2>&1
(for /d %%v in (*kb917607*) do @rd /s /q "%%v") & (md kb917607\x64 kb917607\x86)
(if not exist *8.1-kb917607-x64* wget.exe "http://download.microsoft.com/download/A/5/6/A5651A53-2487-43C6-835A-744EB9C72579/Windows8.1-KB917607-x64.msu" || bitsadmin.exe /transfer kb917607 "http://download.microsoft.com/download/A/5/6/A5651A53-2487-43C6-835A-744EB9C72579/Windows8.1-KB917607-x64.msu" "%cd%\Windows8.1-KB917607-x64.msu") >nul 2>&1
(expand /f:win*.cab Windows8.1-KB917607-x64.msu .
expand /f:* Windows8.1-KB917607-x64.cab kb917607) >nul
@cd kb917607 & del *.man *.cat *.mum
(for /f "tokens=5 delims=_" %%a in ('dir x86* /b') do @move x86*%%a* x86\%%a
for /f "tokens=5 delims=_" %%a in ('dir amd* /b') do @move amd*%%a* x64\%%a) >nul
(if /i %processor_architecture%==x86 (
for /f "tokens=4 delims=~" %%v in ('dism.exe /online /get-packages /format:table /english ^| find /i "language pack"') do @(
takeown.exe /f %windir%\%%v\winhlp32.exe.mui
takeown.exe /f %windir%\system32\%%v\ftsrch.dll.mui
icacls.exe %windir%\%%v\winhlp32.exe.mui /grant "%username%:f"
icacls.exe %windir%\system32\%%v\ftsrch.dll.mui /grant "%username%:f"
copy x86\%%v\winhlp32.exe.mui %windir%\%%v
copy x86\%%v\ftsrch.dll.mui %windir%\system32\%%v
icacls.exe %windir%\%%v\winhlp32.exe.mui /setowner "nt service\trustedinstaller"
icacls.exe %windir%\system32\%%v\ftsrch.dll.mui /setowner "nt service\trustedinstaller"
icacls.exe %windir%\%%v\winhlp32.exe.mui /remove "%username%"
icacls.exe %windir%\system32\%%v\ftsrch.dll.mui /remove "%username%"
)
takeown.exe /f %windir%\winhlp32.exe
takeown.exe /f %windir%\system32\ftlx0411.dll
takeown.exe /f %windir%\system32\ftlx041e.dll
takeown.exe /f %windir%\system32\ftsrch.dll
icacls.exe %windir%\winhlp32.exe /grant "%username%:f"
icacls.exe %windir%\system32\ftlx0411.dll /grant "%username%:f"
icacls.exe %windir%\system32\ftlx041e.dll /grant "%username%:f"
icacls.exe %windir%\system32\ftsrch.dll /grant "%username%:f"
copy x86\none\winhlp32.exe %windir%
copy x86\none\ftlx0411.dll %windir%\system32
copy x86\none\ftlx041e.dll %windir%\system32
copy x86\none\ftsrch.dll %windir%\system32
icacls.exe %windir%\winhlp32.exe /setowner "nt service\trustedinstaller"
icacls.exe %windir%\system32\ftlx0411.dll /setowner "nt service\trustedinstaller"
icacls.exe %windir%\system32\ftlx041e.dll /setowner "nt service\trustedinstaller"
icacls.exe %windir%\system32\ftsrch.dll /setowner "nt service\trustedinstaller"
icacls.exe %windir%\winhlp32.exe /remove "%username%"
icacls.exe %windir%\system32\ftlx0411.dll /remove "%username%"
icacls.exe %windir%\system32\ftlx041e.dll /remove "%username%"
icacls.exe %windir%\system32\ftsrch.dll /remove "%username%"
) else (
for /f "tokens=4 delims=~" %%v in ('dism.exe /online /get-packages /format:table /english ^| find /i "language pack"') do @(
takeown.exe /f %windir%\%%v\winhlp32.exe.mui
takeown.exe /f %windir%\system32\%%v\ftsrch.dll.mui
takeown.exe /f %windir%\syswow64\%%v\ftsrch.dll.mui
icacls.exe %windir%\%%v\winhlp32.exe.mui /grant "%username%:f"
icacls.exe %windir%\system32\%%v\ftsrch.dll.mui /grant "%username%:f"
icacls.exe %windir%\syswow64\%%v\ftsrch.dll.mui /grant "%username%:f"
copy x64\%%v\winhlp32.exe.mui %windir%\%%v
copy x64\%%v\ftsrch.dll.mui %windir%\system32\%%v
copy x86\%%v\ftsrch.dll.mui %windir%\syswow64\%%v
icacls.exe %windir%\%%v\winhlp32.exe.mui /setowner "nt service\trustedinstaller"
icacls.exe %windir%\system32\%%v\ftsrch.dll.mui /setowner "nt service\trustedinstaller"
icacls.exe %windir%\syswow64\%%v\ftsrch.dll.mui /setowner "nt service\trustedinstaller"
icacls.exe %windir%\%%v\winhlp32.exe.mui /remove "%username%"
icacls.exe %windir%\system32\%%v\ftsrch.dll.mui /remove "%username%"
icacls.exe %windir%\syswow64\%%v\ftsrch.dll.mui /remove "%username%"
)
takeown.exe /f %windir%\winhlp32.exe
takeown.exe /f %windir%\system32\ftlx0411.dll
takeown.exe /f %windir%\system32\ftlx041e.dll
takeown.exe /f %windir%\system32\ftsrch.dll
takeown.exe /f %windir%\syswow64\ftlx0411.dll
takeown.exe /f %windir%\syswow64\ftlx041e.dll
takeown.exe /f %windir%\syswow64\ftsrch.dll
icacls.exe %windir%\winhlp32.exe /grant "%username%:f"
icacls.exe %windir%\system32\ftlx0411.dll /grant "%username%:f"
icacls.exe %windir%\system32\ftlx041e.dll /grant "%username%:f"
icacls.exe %windir%\system32\ftsrch.dll /grant "%username%:f"
icacls.exe %windir%\syswow64\ftlx0411.dll /grant "%username%:f"
icacls.exe %windir%\syswow64\ftlx041e.dll /grant "%username%:f"
icacls.exe %windir%\syswow64\ftsrch.dll /grant "%username%:f"
copy x64\none\winhlp32.exe %windir%
copy x64\none\ftlx0411.dll %windir%\system32
copy x64\none\ftlx041e.dll %windir%\system32
copy x64\none\ftsrch.dll %windir%\system32
copy x86\none\ftlx0411.dll %windir%\syswow64
copy x86\none\ftlx041e.dll %windir%\syswow64
copy x86\none\ftsrch.dll %windir%\syswow64
icacls.exe %windir%\winhlp32.exe /setowner "nt service\trustedinstaller"
icacls.exe %windir%\system32\ftlx0411.dll /setowner "nt service\trustedinstaller"
icacls.exe %windir%\system32\ftlx041e.dll /setowner "nt service\trustedinstaller"
icacls.exe %windir%\system32\ftsrch.dll /setowner "nt service\trustedinstaller"
icacls.exe %windir%\syswow64\ftlx0411.dll /setowner "nt service\trustedinstaller"
icacls.exe %windir%\syswow64\ftlx041e.dll /setowner "nt service\trustedinstaller"
icacls.exe %windir%\syswow64\ftsrch.dll /setowner "nt service\trustedinstaller"
icacls.exe %windir%\winhlp32.exe /remove "%username%"
icacls.exe %windir%\system32\ftlx0411.dll /remove "%username%"
icacls.exe %windir%\system32\ftlx041e.dll /remove "%username%"
icacls.exe %windir%\system32\ftsrch.dll /remove "%username%"
icacls.exe %windir%\syswow64\ftlx0411.dll /remove "%username%"
icacls.exe %windir%\syswow64\ftlx041e.dll /remove "%username%"
icacls.exe %windir%\syswow64\ftsrch.dll /remove "%username%"
) ) >nul
@cd .. & reg.exe import winhelpr.cmd /reg:32 & ping -n 4 localhost > nul
語法:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WinHelp]
"AllowIntranetAccess"=dword:00000001
"AllowProgrammaticMacros"=dword:00000001
語法:
Windows Registry Editor Version 5.00 (self-contained registry script) 2>nul
; @(net.exe file || openfiles.exe || ele.%processor_architecture% "%~f0" && exit /b || exit /b) >nul 2>&1
; @(reg.exe import "%~f0" /reg:32 || regedit.exe /s "%~f0" & exit /b) 2>nul
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WinHelp]
"AllowIntranetAccess"=dword:00000001
"AllowProgrammaticMacros"=dword:00000001
書籤