Hỏi:
Tôi muốn Disable phần BHO của Internet Explorer vì nhiều khi các chương trình virus lợi dụng tính năng trên để cài cắm vào máy tính của tôi?satthubong hướng dẫn :
- Mở NotePad tạo file ví dụ có tên là BHO.BAT có nội dung dưới đây :
Trích dẫn:
@echo off
setlocal ENABLEDELAYEDEXPANSION
if /i {%1}=={L} goto OK1
if {%2}=={} goto err
if /i {%1}=={D} goto OK1
if /i {%1}=={E} goto OK1
:err
@echo Syntax: DisableHelperObjects D^|E^|L [ALL^|ObjectNumber]
endlocal
goto :EOF
:OK1
set /a number=0
set what=N
set action=%1
if /i "%action%" EQU "L" goto OK2
set what=%2
if /i "%what%" EQU "ALL" goto OK2
if "%what%" LSS "1" goto err
if "%what%" GTR "9" goto err
set /a number=10%what%%%10
if "%what%" NEQ "%number%" goto err
:OK2
regedit /a "%TEMP%\DisableHelperObjects.tm1" "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\
CurrenTVersion\Explorer\Browser Helper Objects"
@echo REGEDIT4>"%TEMP%\DisableHelperObjects.tm2"
@echo.>>"%TEMP%\DisableHelperObjects.tm2"
set /a cnt=0
@echo Before
@echo.
for /f "Tokens=*" %%a in ('type "%TEMP%\DisableHelperObjects.tm1"^|FIND "\{"') do (
set /a cnt=!cnt! + 1
set work=%%a
set work=!work:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\
CurrenTVersion\Explorer\Browser Helper Objects\=!
set work=!work:[=!
set work=!work:]=!
@echo !cnt! !work!
@echo %%a>>"%TEMP%\DisableHelperObjects.tm2"
@echo.>>"%TEMP%\DisableHelperObjects.tm2"
)
@echo.>>"%TEMP%\DisableHelperObjects.tm2"
del /q "%TEMP%\DisableHelperObjects.tm1
if /i "%action%" EQU "L" goto finish
@echo REGEDIT4>"%TEMP%\DisableHelperObjects.tm1"
@echo.>>"%TEMP%\DisableHelperObjects.tm1"
set OK=N
set /a cnt=0
for /f "Tokens=*" %%a in ('type "%TEMP%\DisableHelperObjects.tm2"^|FIND "\{"') do (
set /a cnt=!cnt! + 1
set work=%%a
call :doit
)
if %number% NEQ 0 if "%OK%" EQU "N" @echo.&@echo Helper Object %number% not found.&goto after
regedit /s "%TEMP%\DisableHelperObjects.tm1"
:after
regedit /a "%TEMP%\DisableHelperObjects.tm1" "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\
CurrenTVersion\Explorer\Browser Helper Objects"
@echo.
@echo After
@echo.
set /a cnt=0
for /f "Tokens=*" %%a in ('type "%TEMP%\DisableHelperObjects.tm1"^|FIND "\{"') do (
set /a cnt=!cnt! + 1
set work=%%a
set work=!work:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\
CurrenTVersion\Explorer\Browser Helper Objects\=!
set work=!work:[=!
set work=!work:]=!
@echo !cnt! !work!
)
del /q "%TEMP%\DisableHelperObjects.tm1
:finish
endlocal
goto :EOF
:doit
if /i "%action%" EQU "E" goto doite
if %number% EQU 0 goto doitda
if %number% NEQ %cnt% goto :EOF
set OK=Y
:doitda
set tst=%work%
set tst=%tst:#NO#}=}%
if "%tst%" NEQ "%work%" goto :EOF
set del=%work%
set del=%del:[=[-%
@echo %del%>>"%TEMP%\DisableHelperObjects.tm1"
@echo.>>"%TEMP%\DisableHelperObjects.tm1"
set work=%work:}=#NO#}%
:doitout
@echo %work%>>"%TEMP%\DisableHelperObjects.tm1"
@echo.>>"%TEMP%\DisableHelperObjects.tm1"
goto :EOF
:doite
if /i "%what%" EQU "ALL" goto doitea
if %number% NEQ %cnt% goto :EOF
set OK=Y
:doitea
set tst=%work%
set tst=%tst:#NO#}=}%
if "%tst%" EQU "%work%" goto :EOF
set del=%work%
set del=%del:[=[-%
@echo %del%>>"%TEMP%\DisableHelperObjects.tm1"
@echo.>>"%TEMP%\DisableHelperObjects.tm1"
set work=%work:#NO#}=}%
goto doitout
setlocal ENABLEDELAYEDEXPANSION
if /i {%1}=={L} goto OK1
if {%2}=={} goto err
if /i {%1}=={D} goto OK1
if /i {%1}=={E} goto OK1
:err
@echo Syntax: DisableHelperObjects D^|E^|L [ALL^|ObjectNumber]
endlocal
goto :EOF
:OK1
set /a number=0
set what=N
set action=%1
if /i "%action%" EQU "L" goto OK2
set what=%2
if /i "%what%" EQU "ALL" goto OK2
if "%what%" LSS "1" goto err
if "%what%" GTR "9" goto err
set /a number=10%what%%%10
if "%what%" NEQ "%number%" goto err
:OK2
regedit /a "%TEMP%\DisableHelperObjects.tm1" "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\
CurrenTVersion\Explorer\Browser Helper Objects"
@echo REGEDIT4>"%TEMP%\DisableHelperObjects.tm2"
@echo.>>"%TEMP%\DisableHelperObjects.tm2"
set /a cnt=0
@echo Before
@echo.
for /f "Tokens=*" %%a in ('type "%TEMP%\DisableHelperObjects.tm1"^|FIND "\{"') do (
set /a cnt=!cnt! + 1
set work=%%a
set work=!work:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\
CurrenTVersion\Explorer\Browser Helper Objects\=!
set work=!work:[=!
set work=!work:]=!
@echo !cnt! !work!
@echo %%a>>"%TEMP%\DisableHelperObjects.tm2"
@echo.>>"%TEMP%\DisableHelperObjects.tm2"
)
@echo.>>"%TEMP%\DisableHelperObjects.tm2"
del /q "%TEMP%\DisableHelperObjects.tm1
if /i "%action%" EQU "L" goto finish
@echo REGEDIT4>"%TEMP%\DisableHelperObjects.tm1"
@echo.>>"%TEMP%\DisableHelperObjects.tm1"
set OK=N
set /a cnt=0
for /f "Tokens=*" %%a in ('type "%TEMP%\DisableHelperObjects.tm2"^|FIND "\{"') do (
set /a cnt=!cnt! + 1
set work=%%a
call :doit
)
if %number% NEQ 0 if "%OK%" EQU "N" @echo.&@echo Helper Object %number% not found.&goto after
regedit /s "%TEMP%\DisableHelperObjects.tm1"
:after
regedit /a "%TEMP%\DisableHelperObjects.tm1" "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\
CurrenTVersion\Explorer\Browser Helper Objects"
@echo.
@echo After
@echo.
set /a cnt=0
for /f "Tokens=*" %%a in ('type "%TEMP%\DisableHelperObjects.tm1"^|FIND "\{"') do (
set /a cnt=!cnt! + 1
set work=%%a
set work=!work:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\
CurrenTVersion\Explorer\Browser Helper Objects\=!
set work=!work:[=!
set work=!work:]=!
@echo !cnt! !work!
)
del /q "%TEMP%\DisableHelperObjects.tm1
:finish
endlocal
goto :EOF
:doit
if /i "%action%" EQU "E" goto doite
if %number% EQU 0 goto doitda
if %number% NEQ %cnt% goto :EOF
set OK=Y
:doitda
set tst=%work%
set tst=%tst:#NO#}=}%
if "%tst%" NEQ "%work%" goto :EOF
set del=%work%
set del=%del:[=[-%
@echo %del%>>"%TEMP%\DisableHelperObjects.tm1"
@echo.>>"%TEMP%\DisableHelperObjects.tm1"
set work=%work:}=#NO#}%
:doitout
@echo %work%>>"%TEMP%\DisableHelperObjects.tm1"
@echo.>>"%TEMP%\DisableHelperObjects.tm1"
goto :EOF
:doite
if /i "%what%" EQU "ALL" goto doitea
if %number% NEQ %cnt% goto :EOF
set OK=Y
:doitea
set tst=%work%
set tst=%tst:#NO#}=}%
if "%tst%" EQU "%work%" goto :EOF
set del=%work%
set del=%del:[=[-%
@echo %del%>>"%TEMP%\DisableHelperObjects.tm1"
@echo.>>"%TEMP%\DisableHelperObjects.tm1"
set work=%work:#NO#}=}%
goto doitout
3. Lưu file trên , đóng tất cả cửa sổ của IE
4. Chạy file BHO.BAT với cú pháp như sau :
- BHO.BAT D ALL --> Disable tất cả BHO
- BHO.BAT E ALL --> Enable tất cả BHO
- BHO.BAT D Object Number hoặc BHO E Object Number