@echo off
 REM MODE 1000,1000
 mode 20,10
 REM  COLOR B0
 REM 切換目錄為批次檔所在位置
 cd /d %~dp0
 setlocal EnableDelayedExpansion
 
 
:PrepareForColor 
 for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
  set "DEL=%%a"
 )
 rem Prepare a file "X" with only one dot
 <nul > X set /p ".=.
  
:StringSetting
 set currentVersion=2.6
 set normalStr=線上簽核
 set cmdTitle=歡迎使用臺北市公文線上簽核環境設定一鍵安裝批次檔
 set versionUrl=https://dl.dropboxusercontent.com/u/56308276/ver.txt
 set downloadLink=https://dl.dropboxusercontent.com/u/56308276/docweb.zip
 set alertTitle=線上簽核一鍵安裝
 set updateStr1=已有新版本
 set updateStr2=是否要下載!
 set noUpdateStr=目前已是最新版本!
 set personnelStr=如欲安裝於人事電腦請先升級至IE11後再執行本程式!
 set adminStr=請使用右鍵以系統管理員身分執行!
 set netconnection1=可開啟網路以檢查是否有新版本
 set downloadErrorStr=下載連結可能有誤，請聯絡程式作者修正謝謝!
 set downloadCompletedStr=下載完畢，請解壓縮新版本使用!
 set installType=請選擇安裝類型：〔1 or 2〕
 set restartStr=是否重新啟動電腦？手動重啟請按 N，自動重啟請按 Y ：〔Y or N〕
 set versionCheckStr=檢查檔案版本中
 set warningStr=請勿關閉本視窗！
 set versionErrStr=程式版本號有誤，將自動重新下載！
 set author=Eric Liao
 
 
:CheckInternet
 Ping www.google.com -n 1 -w 1000>NUL
 if %errorlevel%==1 start "" /wait mshta vbscript:Execute("msgbox ""%netconnection1%"",0,""%alertTitle%v%currentVersion%"":close") & GOTO CheckPermissions
 
 
:CheckUpdate
 call :color 0E "%versionCheckStr%" & echo(
 call :color 0C "%warningStr%" & echo(
 for /f %%i in ('wget.exe -qO- %versionUrl%') do set latestVersion=%%i
 echo curr: %currentVersion% & echo(
 echo newv: %latestVersion% & echo(
 if %currentVersion% lss %latestVersion% goto UpdateAvailable
 if %currentVersion% gtr %latestVersion% goto VersionError
 if %currentVersion%==%latestVersion% goto NoUpdate

:UpdateAvailable
 REM start "" /wait mshta vbscript:Execute("msgbox ""%updateStr1%v%latestVersion%%updateStr2%"",0,""%alertTitle%v%currentVersion%"":close")
 for /f "usebackq" %%I in (`CSCRIPT .\vbs\update.vbs %updateStr1%v%latestVersion%%updateStr2% %alertTitle%v%currentVersion%`) do set "abc=%%I"
 if %abc%==6 GOTO DownloadNewVersion
 if %abc%==7 GOTO CheckPermissions
 

:DownloadNewVersion
 Start "" /WAIT wget.exe -nv --spider %downloadLink%
 if %errorlevel%==0 Start "" /WAIT wget.exe -q -N --show-progress --progress=bar:noscroll -O %normalStr%%latestVersion%.zip %downloadLink% 2>&1 && GOTO DownloadCompleted
 if %errorlevel% gtr 0 start "" /wait mshta vbscript:Execute("msgbox ""%downloadErrorStr%"",0,""%alertTitle%v%currentVersion%"":close") && EXIT
 
:NoUpdate
 start "" /wait mshta vbscript:Execute("msgbox ""%noUpdateStr%"",0,""%alertTitle%v%currentVersion%"":close")
 GOTO CheckPermissions
 
:VersionError
 start "" /wait mshta vbscript:Execute("msgbox ""%versionErrStr%"",0,""%alertTitle%v%currentVersion%"":close")
 GOTO DownloadNewVersion
 
:DownloadCompleted 
 start "" /wait mshta vbscript:Execute("msgbox ""%downloadCompletedStr%"",0,""%alertTitle%v%currentVersion%"":close") && EXIT
 
:CheckPermissions
 fltmc >nul 2>&1 && ( GOTO ISAdmin ) || ( GOTO NotAdmin )


:ISAdmin
 start "" /wait mshta vbscript:Execute("msgbox ""%personnelStr%"",0,""%alertTitle%v%currentVersion%"":close")


:CheckOSVersion
 for /f "usebackq tokens=1,2 delims==|" %%I in (`wmic os get name^,version /format:list`) do 2>NUL set "%%I=%%J"
 for /f "tokens=2 delims==" %%I in ('wmic bios get version /format:list') do set "bios=%%I"
 for /f "tokens=2 delims==" %%I in ('wmic computersystem get model /format:list') do set "model=%%I"
 set RegQry=HKLM\Hardware\Description\System\CentralProcessor\0
 REG Query %RegQry% 2>NUL | find /I /N "x86" 2>NUL
 If %ERRORLEVEL%==0 (set OsVersion=32) ELSE (set OsVersion=64)


:CheckIEVersion
 set "KEY_NAME=HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer"
 set "VALUE_NAME=svcVersion"
 REG QUERY "%KEY_NAME%" /v "%VALUE_NAME%">NUL
 if %ERRORLEVEL%==1 set "VALUE_NAME=Version"
 for /f "tokens=2*" %%A IN ('REG QUERY "%KEY_NAME%" /v "%VALUE_NAME%"') do (
  set "versionNumber=%%B" & set "versionNumberDetail=%%B"
 )
 for /f "delims=." %%a in ("%versionNumber%") do set "versionNumber=%%a"


:CheckFlashPlayerVersion
 set key="HKEY_LOCAL_MACHINE\Software\Macromedia\FlashPlayer"
 for /f "tokens=2*" %%a in ('REG QUERY %key% /v CurrentVersion') do set "FlashVersion=%%b"
 
:CheckSmartCardStatus
 set SCKey="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SCardSvr" 
 set SCValue="Start"
 for /f "tokens=2*" %%a in ('REG QUERY %SCKey% /v %SCValue%') do (
 set SCStartupType=%%b
 ) 
 for /f "tokens=1,2 delims=x" %%a in ("%SCStartupType%") do set SCStartupType=%%b 
 SC Query SCardSvr | Find "STATE" | FIND "RUNNING"
 If %ERRORLEVEL%==1 (set SCServiceStatus=N) ELSE ( set SCServiceStatus=Y )

REM 資料夾定義
 set HiCOSDir64="C:\Program Files (x86)\Chunghwa Telecom\HiCOS PKI Smart Card"
 set HiCOSDir32=C:\Program Files\Chunghwa Telecom\HiCOS PKI Smart Card 
 set HiCOSDir=!HiCOSDir%OsVersion%!

 set SYSDir64=%windir%\SysWOW64
 set SYSDir32=%windir%\System32
 set SYSDir=!SYSDir%OsVersion%!

 set AIDBDIR64=C:\Program Files (x86)\CNSFontTools
 set AIDBDIR32=C:\Program Files\CNSFontTools
 set AIDBDIR=!AIDBDIR%OsVersion%!
 
REM 登陸檔移除字串定義
 set UninstallRegKey64="HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
 set UninstallRegKey32="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
 set UninstallRegKey=!UninstallRegKey%OsVersion%!
 set BingRegKey64="HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\BingBar"
 set BingRegKey32="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\BingBar"
 set BingRegKey=!BingRegKey%OsVersion%!


:CheckGoogleToolbarUninstallString
 set GoogleFLG=N
 set "KEY_NAME=%UninstallRegKey%\{2318C2B1-4965-11d4-9B18-009027A5CD4F}"
 set "VALUE_NAME=UninstallString"
 REG QUERY "%KEY_NAME%" /v "%VALUE_NAME%">NUL 
 if %ERRORLEVEL%==0 (
  set GoogleFLG=Y
  REM for /f "tokens=2*" %%A IN ('REG QUERY "%KEY_NAME%" /v "%VALUE_NAME%"') do set "googleUninstallString=%%B"
 )

:CheckYahooToolbarUninstallString
 set YahooFLG=N
 set "KEY_NAME=%UninstallRegKey%\Yahoo^! Toolbar"
 set "VALUE_NAME=UninstallString"
 REG QUERY "!KEY_NAME!" /v "%VALUE_NAME%">NUL
 
 if %ERRORLEVEL%==0 (
  set YahooFLG=Y
  REM for /f "tokens=2*" %%A IN ('REG QUERY "!KEY_NAME!" /v "%VALUE_NAME%"') do set "yahooUninstallString=%%B"
 )
 
:CheckBingbarUninstallString
 set BingFLG=N
 set "KEY_NAME=%BingRegKey%"
 set "VALUE_NAME=ProductCode"
 REG QUERY "%KEY_NAME%" /v "%VALUE_NAME%"
 
 if %ERRORLEVEL%==0 ( set BingFLG=Y )

CLS
mode 100,30
TITLE %cmdTitle% v%currentVersion% by %author%
call :color 0E "作業系統：" & call :color 0F "%name% %OsVersion%位元" & echo(
call :color 0E "主機型號：" & call :color 0F "%model%" & echo(
call :color 0E "IE版本為：" & call :color 0F "IE %versionNumber% (%versionNumberDetail%)" & echo(
call :color 0E "FlashPlayer 版本：" & call :color 0F "%FlashVersion%" & call :color 00 "      "
call :color 0E "智慧卡啟動類型：" 
if %SCStartupType%==2 call :color 0F "自動"
if %SCStartupType%==3 call :color 0F "手動"
if %SCStartupType%==4 call :color 0C "已停用"
echo(
call :color 0E "智慧卡服務狀態：" 
if %SCServiceStatus%==Y (call :color 0F "執行中") ELSE ( call :color 0C "已停止" )
echo(
call :color 0E "Google Toolbar："
if %GoogleFLG%==Y (call :color 0C "已安裝" ) ELSE ( call :color 0F "未安裝")
call :color 00 "      "
call :color 0E "Yahoo Toolbar："
if %YahooFLG%==Y (call :color 0C "已安裝" ) ELSE ( call :color 0F "未安裝")
call :color 00 "      "
call :color 0E "Bingbar："
if %BingFLG%==Y (call :color 0C "已安裝" ) ELSE ( call :color 0F "未安裝")
echo(
echo.
call :color 0B "*******************************************************************************" & echo(
call :color 0B "* ◎本批次檔請以右鍵系統管理員權限執行                                        *" & echo(
call :color 0B "* ◎本批次檔包含 1.線上簽核五個元件                                           *" & echo(
call :color 0B "*                2.IE設定(ActiveX)調整                                        *" & echo(
call :color 0B "*                3.移除Yahoo、Google及Bing工具列                              *" & echo(
call :color 0B "*                4.禁止IE自動更新                                             *" & echo(
call :color 0B "*                5.全字庫軟體安裝                                             *" & echo(
call :color 0B "*                6.IE可選擇降為 IE8                                           *" & echo(
call :color 0B "* ◎本批次檔僅在Win7 64 及32環境中測試正常，其他環境並未測試                  *" & echo(
call :color 0B "* ◎配合人事系統運行，若欲安裝於人事電腦請先升級IE 11 後再行執行本程式        *" & echo(
call :color 0B "* ◎batch create and edit by ch.ho.liao@gmail.com                             *" & echo(
call :color 0B "*******************************************************************************" & echo(
echo.

:SEARCH
 tasklist|find "iexplore.exe" >nul
 IF ERRORLEVEL 1 (GOTO NORUNNING)
 IF ERRORLEVEL 0 (GOTO KILLPROG)

:KILLPROG
 echo 關閉IE中...
 taskkill /F /IM iexplore.exe /T >nul
 TIMEOUT /T 1 >nul
 GOTO SEARCH

:NORUNNING
 call :color 0F "%installType%" & echo(
 call :color 0F " 1.一般行政電腦"
 call :color 0F " 2.人事主任電腦"
 echo.
 choice /c 12 /N /m ""
 IF ERRORLEVEL 1 (set installOP=1)
 IF ERRORLEVEL 2 (set installOP=2)
 
 if %versionNumber% GEQ 11 (
  GOTO DOWNGRADECHECK
 ) else (
  if %versionNumber%==8 (GOTO IE8)
  if %versionNumber%==9 (GOTO DOWNGRADECHECK)
  if %versionNumber%==10 (GOTO DOWNGRADECHECK)
  GOTO END
 )


:IE8
 echo 目前版本為IE8，可正常執行公文整合系統
 GOTO RESETIE

:RESETIE
 START "" /WAIT rundll32.exe inetcpl.cpl ResetIEtoDefaults
 GOTO BLOCKIE
 
:BLOCKIE
 REM 禁止WINDOWS UPDATE 更新IE 
 reg add "HKLM\SOFTWARE\Microsoft\Internet Explorer\Setup\11.0" /v DoNotAllowIE11 /t REG_DWORD /d 1 /F>NUL
 reg add "HKLM\SOFTWARE\Microsoft\Internet Explorer\Setup\10.0" /v DoNotAllowIE10 /t REG_DWORD /d 1 /F>NUL
 reg add "HKLM\SOFTWARE\Microsoft\Internet Explorer\Setup\9.0" /v DoNotAllowIE90 /t REG_DWORD /d 1 /F>NUL
 REM 取消IE10以上自動安裝新版本選項 
 if %versionNumber% GEQ 10 (
 reg add "HKLM\SOFTWARE\Microsoft\Internet Explorer\MAIN" /v EnableAutoUpgrade /t REG_DWORD /d 0 /f>NUL
 )
 GOTO REMOVETOOLBAR

 
:INSTALLDOCWEB
 REM 信任網站設定
 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\taipei.gov.tw" /v "http" /t REG_DWORD /d 2 /f>NUL
 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\taipei.gov.tw\docweb" /v "https" /t REG_DWORD /d 2 /f>NUL
 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\taipei.gov.tw\doctest" /v "https" /t REG_DWORD /d 2 /f>NUL
 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\taipei.gov.tw\signweb" /v "https" /t REG_DWORD /d 2 /f>NUL
 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Ranges\Range1" /v "http" /t REG_DWORD /d 2 /f>NUL
 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Ranges\Range1" /v ":Range" /t REG_SZ /d 163.29.37.107 /f>NUL
 
 REM 信任網站安全性等級設定
 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\2" /v "CurrentLevel" /t REG_DWORD /d 0 /f>NUL 
 
 REM 安裝資通簽章元件
 START "" /WAIT .\software\AresPKIInstaller_ActiveX_v7_4_0_16_silent.exe /quiet

 REM IE安全性設定程式
 START "" /WAIT .\software\IESettingClient.exe

 REM 線上簽核元件及其他元件安裝
 if not exist C:\infodoc mkdir C:\infodoc
 start /wait xcopy .\component %SYSDir%\ /E /I /Y
 %SYSDir%\regsvr32.exe /s %SYSDir%\capicom.dll
 %SYSDir%\regsvr32.exe /s %SYSDir%\ExcelReportToolProj1.ocx
 %SYSDir%\regsvr32.exe /s %SYSDir%\IFDWeb.ocx
 %SYSDir%\regsvr32.exe /s %SYSDir%\tcgListProj1.ocx
 

 REM IE元件重新註冊
 %SYSDir%\regsvr32.exe /s %SYSDir%\scrrun.dll

 REM 修改相容性檢視 for taipei.gov.tw  gov.taipei and dgpa.gov.tw
 reg add "HKCU\Software\Microsoft\Internet Explorer\BrowserEmulation\ClearableListData" /v UserFilter /t REG_BINARY /d 411f00005308adba030000008600000001000000030000000c000000c2c346f6942ad201010000000d007400610069007000650069002e0067006f0076002e00740077000c000000435ce603952ad201010000000a0067006f0076002e007400610069007000650069000c00000003d1479e952ad201010000000b0064006700700061002e0067006f0076002e0074007700 /f>NUL 
 
 REM 允許主動式內容在我的電腦上執行 選項打勾
 reg add "HKCU\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_LOCALMACHINE_LOCKDOWN" /V iexplore.exe /T REG_DWORD /D 0 /F>NUL

 REM 修改瀏灠歷程記錄為每次造訪網頁時
 FOR /F "tokens=1" %%A IN ('reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v SyncMode5 /t REG_DWORD /d 0x0000003 /f ') DO Set SyncMode5_status=%%A

 
 REM 刪除瀏覽歷程紀錄各選項
 REM 勾選  保留我的最愛網站資料
 reg add "HKCU\Software\Microsoft\Internet Explorer\Privacy" /v UseAllowList /t REG_DWORD /D 1 /F>NUL
 REM 勾選  網際網路暫存檔與網站檔案
 reg add "HKCU\Software\Microsoft\Internet Explorer\Privacy" /v CleanTIF /t REG_DWORD /D 1 /F>NUL
 REM 勾選  Cookie 與資料網站
 reg add "HKCU\Software\Microsoft\Internet Explorer\Privacy" /v CleanCookies /t REG_DWORD /D 1 /F>NUL
 REM 取消勾選  歷程記錄
 reg add "HKCU\Software\Microsoft\Internet Explorer\Privacy" /v CleanHistory /t REG_DWORD /D 0 /F>NUL
 REM 取消勾選  下載歷程記錄
 reg add "HKCU\Software\Microsoft\Internet Explorer\Privacy" /v CleanDownloadHistory /t REG_DWORD /D 0 /F>NUL
 REM 取消勾選  表單資料
 reg add "HKCU\Software\Microsoft\Internet Explorer\Privacy" /v CleanForms /t REG_DWORD /D 0 /F>NUL
 REM 取消勾選  密碼
 reg add "HKCU\Software\Microsoft\Internet Explorer\Privacy" /v CleanPassword /t REG_DWORD /D 0 /F>NUL
 REM 取消勾選  追蹤保護、ActiveX 篩選與 Do Not Track 資料
 reg add "HKCU\Software\Microsoft\Internet Explorer\Privacy" /v CleanTrackingProtection /t REG_DWORD /D 0 /F>NUL
 
 
 
 REM 啟用XSS篩選器 停用
 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\2" /v "1409" /t reg_dword /d 0x3 /f>NUL

 REM 安裝HiCOS自然人憑證管理工具
 START "" /WAIT ".\software\HiCOS Client v2.1.9.1u.exe" /S

 REM 安裝全字庫軟體包 version 104_1
 START "" /WAIT .\software\AIDB_soft_104_1.exe /S
 
 REM 關閉快顯封鎖程式選項
 reg add "HKCU\Software\Microsoft\Internet Explorer\New Windows" /v PopupMgr /t REG_DWORD /D 0 /F>NUL

 REM 移除 HiCOS隨附安裝的CHT Up2Date軟體
 START "" /WAIT "C:\Windows\CHT Up2Date Service\uninstall.exe" "/U:C:\UTDService\Uninstall\uninstall.xml" /S
 
 REM 設定智慧卡啟動類型為自動
 reg add "HKLM\SYSTEM\CurrentControlSet\services\SCardSvr" /v Start /t REG_DWORD /D 2 /F>NUL
 REM 啟動智慧卡服務
 if %SCServiceStatus%==N (net start SCardSvr >NUL 2>&1 )
 
 if %installOP%==1 (GOTO END)
 if %installOP%==2 (GOTO PERSONNEL)
 
 
:DOWNGRADECHECK
 REM 降版IE8前確認
 choice /c YN /N /m "目前版本為 IE%versionNumber% 是否降版為IE8 ?(Y/N)"
 IF ERRORLEVEL 2 (GOTO BLOCKIE)
 IF ERRORLEVEL 1 (GOTO UNINSTALL)


:UNINSTALL
 REM 移除IE11 IE10 IE9
 echo 降版中...
 cmd /c FORFILES /P %WINDIR%\servicing\Packages /M Microsoft-Windows-InternetExplorer-*11.*.mum /C "cmd /c echo @fname && start /w pkgmgr /up:@fname /quiet /norestart"
 cmd /c FORFILES /P %WINDIR%\servicing\Packages /M Microsoft-Windows-InternetExplorer-*10.*.mum /C "cmd /c echo @fname && start /w pkgmgr /up:@fname /quiet /norestart"
 cmd /c FORFILES /P %WINDIR%\servicing\Packages /M Microsoft-Windows-InternetExplorer-*9.*.mum /C "cmd /c echo @fname && start /w pkgmgr /up:@fname /quiet /norestart"
 GOTO BLOCKIE
 

:REMOVETOOLBAR
 if %GoogleFLG%==Y START "" /WAIT .\vbs\RemoveGoogle.vbs  & echo 已移除Google Toolbar
 if %YahooFLG%==Y START "" /WAIT .\vbs\RemoveYahoo.vbs & echo 已移除Yahoo Toolbar
 if %BingFLG%==Y START "" /WAIT .\vbs\RemoveBing.vbs & echo 已移除Bingbar 
 GOTO INSTALLDOCWEB

 
:PERSONNEL
 REM 修改相容性檢視 for taipei.gov.tw  gov.taipei and dgpa.gov.tw
 reg add "HKCU\Software\Microsoft\Internet Explorer\BrowserEmulation\ClearableListData" /v UserFilter /t REG_BINARY /d 411f00005308adba030000008600000001000000030000000c000000c2c346f6942ad201010000000d007400610069007000650069002e0067006f0076002e00740077000c000000435ce603952ad201010000000a0067006f0076002e007400610069007000650069000c00000003d1479e952ad201010000000b0064006700700061002e0067006f0076002e0074007700 /f>NUL 

 REM 新增相容性檢視
 if not exist %Userprofile%\Favorites\勿刪除 mkdir %Userprofile%\Favorites\勿刪除
 REM attrib +h .\favorites\*.*
 start /wait xcopy .\favorites %Userprofile%\Favorites\勿刪除 /E /I /Y
 REM attrib -h .\favorites\*.*

 REM 人事系統信任網站設定
 REM reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\dgpa.gov.tw\webhr" /v "https" /t REG_DWORD /d 2 /f
 REM reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\dgpa.gov.tw\webhredu" /v "https" /t REG_DWORD /d 2 /f
 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\dgpa.gov.tw" /v "*" /t REG_DWORD /d 2 /f>NUL
 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\dgpa.gov.tw" /v "https" /t REG_DWORD /d 2 /f>NUL
 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\ecpa.dgpa.gov.tw" /v "https" /t REG_DWORD /d 2 /f>NUL
 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\taipei.gov.tw" /v "*" /t REG_DWORD /d 2 /f>NUL
 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\gov.taipei" /v "*" /t REG_DWORD /d 2 /f>NUL
 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\bot.com.tw\gnweb" /v "https" /t REG_DWORD /d 2 /f>NUL
 
 REM reg檔整批調整
 REGEDIT /S .\reg\webhr7.reg

 REM 使用 TLS 1.0 TLS 1.1 TLS 1.2 (取消 SSL 2.0 SSL 3.0)
 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v "SecureProtocols" /t reg_dword /d 2688 /f>NUL
 
 REM 顯示混合的內容
 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3" /v "1609" /t REG_DWORD /d 0 /f>NUL
 
 REM 安裝公保E系統 SmartPKI 元件
 START "" /WAIT ".\software\SmartPKI_Install.exe" /passive /quiet
 REM 安裝人事服務網 Ecpa ActiveX 元件
 START "" /WAIT ".\software\Ecpa_ActiveX_Installer_1_1.exe" /S
 REM 安裝人力資源網 WebHR ActiveX 元件
 START "" /WAIT ".\software\System_ActiveX_Setup.exe" /S
 REM 安裝員工愛上網單一簽入 ActiveX 元件
 START "" /WAIT ".\software\AresSSO_Installer_v1.6.5.1.exe" /S
 
 %SYSDir%\regsvr32.exe /s %SYSDir%\prjDownload.ocx
 
 REM 允許網頁使用受限制的通訊協定於主動式內容
 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\2" /v "2300" /t reg_dword /d 0 /f>NUL 
 GOTO END
 
:NotAdmin
 REM 請在本批次檔上使用右鍵以系統管理員身分執行
 start "" /wait mshta vbscript:Execute("msgbox ""%adminStr%"",0,""%alertTitle%v%currentVersion%"":close")
 exit
 
:END
 call :color 0C "%restartStr%"
 choice /c YN /N /m ""
 IF ERRORLEVEL 2 REM (exit)
 IF ERRORLEVEL 1 REM (shutdown -t 0 -r -f)
 endlocal
 exit
 
:color
 set "param=^%~2" !
 set "param=!param:"=\"!"
 findstr /p /A:%1 "." "!param!\..\X" nul
 <nul set /p ".=%DEL%%DEL%%DEL%%DEL%%DEL%%DEL%%DEL%"
 exit /b

::Changelog
::2016/10/29 add net connection check and online update.
::           adjust some code.
::2016/10/20 add popup windows of administrator Privileges check.
::           add Smard card service status check and setting.
::           add bunches of reg settings.
::           add settings for personnel.
::           add online version check. 
::2015/05/27 add Google,Yahoo,Bing bar remove vbscript
::2015/04/15 change downgrade IE optional for IE 11 and above
::2015/04/07 fix if user doesn't disable UAC.
::           update the CNSFonts Version to 104_1.
::2015/04/01 add CHT Up2Date silent uninstall.
::           remove some code unnecessarily.
::2015/03/26 add version check for OS,IE and FlashPlayer
::           adjust code for Win7 x86
::           add goto label.
::           add silent install.
::           add IE downgrade to IE8 (optional).
::           add IE setting reset to default for IE8 (optional).
::2014/10/05 first version for Win7 x64.