2018 七月: Microsoft 改了 filter file 位置,因此修改 download Path .
使用 WHCK / HLK 來做 Windows OS 的 Hardware Certification Test ,一段時間就要手動去更新 Filter data 到 Controller 的DATABASE 中.
要用Browser上網頁下載檔案,解壓縮,複製到目錄下,執行更新程式。好麻煩,要花十來分鐘操作。
想說用 Script 配合 Windows Task 排程,每週自動上網下載然後解壓縮後執行更新程式。
就寫了以下程式>
Update_Filter.bat
預設目錄是 C:\Tools
log file : c:\tools\updatefilters.log
這裡的 Controller 目錄是 windows 10 HLK,如果你要用在 Windows 8.1 WHCK 請自行修改目錄位置。
widows 排程,請自行設定,這裡就不多說了。
@ECHO OFF
C:
cd \tools
TIME /T
cls
REM ---------------------------------------------------------------
REM %time% Delete if exist HCKFilterUpdate.cab & UpdateFilters.sql
REM ---------------------------------------------------------------
if exist C:\tools\HCKFilterUpdate.cab (del /Q ".\HCKFilterUpdate.cab")
if exist ".\UpdateFilters.sql" (del /Q ".\updatefilters.sql")
REM
powershell (new-object System.Net.WebClient).DownloadFile('https://go.microsoft.com/fwlink/?linkid=875139','C:\tools\HCKFilterUpdate.cab')
if %errorlevel% EQU 0 (
ECHO --------------------------------------------------
ECHO %date% %time% Download HCKFilterUpdates.cab successful... >> c:\tools\Updatefilters.log
ECHO --------------------------------------------------
)
if exist C:\tools\HCKFilterUpdate.cab (
expand -I C:\tools\HCKFilterUpdate.cab -F:Updatefilters.sql .\
@DIR Updatefilters.sql |FIND /I"sql" >> Updatefilters.log
) else (
ECHO --------------------------------
ECHO HCKFilterUpdate.cab Not Found...
ECHO --------------------------------
exit
)
ECHO ---------------------------
ECHO Moved UpdateFilter.sql ...
ECHO ---------------------------
move /Y .\Updatefilters.sql "C:\Program Files (x86)\Windows Kits\10\Hardware Lab Kit\Controller"
cd "C:\Program Files (x86)\Windows Kits\10\Hardware Lab Kit\Controller"
ECHO -------------------------------
ECHO %date% %time% Begin Update filter ... >> c:\tools\Updatefilters.log
ECHO -------------------------------
UpdateFilters.exe /s Updatefilters.sql
if %errorlevel% NEQ 0 (
ECHO -------------------------------
ECHO %date% %time% Update Filter Failed...
ECHO %date% %time% Update Filter Failed... >> c:\tools\Updatefilters.log
ECHO -------------------------------
) else (
ECHO -------------------------------------
ECHO %date% %time% Update Filter Successful...
ECHO %date% %time% Update Filter Successful... >> c:\tools\Updatefilters.log
ECHO -------------------------------------
)
cd \tools
EXIT
留言列表