# Code dùng để chặn Zalo trên máy tính dùng Winddows

Nguồn từ : Khánh máy cày&#x20;

.....

@echo off

setlocal enabledelayedexpansion

&#x20;:: Đường dẫn đến file hosts

set HOSTS\_FILE=%SystemRoot%\System32\drivers\etc\hosts

:: Danh sách địa chỉ Zalo

set ADDRESSES=zalo.me chat.zalo.me media.zalo.me api.zalo.me download.zalo.me

:: Menu

echo.

echo ============================

echo Chọn tùy chọn:

echo 1. Chặn Zalo

echo 2. Bỏ chặn Zalo

echo ============================

:: Nhập lựa chọn

set /p CHOICE=Nhập lựa chọn (1 hoặc 2):

:: Thực hiện hành động

if "%CHOICE%"=="1" (

&#x20;   echo Đang chặn Zalo...

&#x20;   for %%A in (%ADDRESSES%) do (

&#x20;       findstr /C:"127.0.0.1 %%A" "%HOSTS\_FILE%" >nul

&#x20;       if errorlevel 1 (

&#x20;           echo 127.0.0.1 %%A >> "%HOSTS\_FILE%"

&#x20;           echo Đã chặn: %%A

&#x20;       ) else (

&#x20;           echo Đã tồn tại: %%A

&#x20;       )

&#x20;   )

&#x20;   echo Hoàn thành. Vui lòng kiểm tra file hosts.

&#x20;   pause

&#x20;   exit

) else if "%CHOICE%"=="2" (

&#x20;   echo Đang bỏ chặn Zalo...

&#x20;   for %%A in (%ADDRESSES%) do (

&#x20;       findstr /C:"127.0.0.1 %%A" "%HOSTS\_FILE%" >nul

&#x20;       if not errorlevel 1 (

&#x20;           findstr /V /C:"127.0.0.1 %%A" "%HOSTS\_FILE%" > "%HOSTS\_FILE%.tmp"

&#x20;           move /Y "%HOSTS\_FILE%.tmp" "%HOSTS\_FILE%" >nul

&#x20;           echo Đã bỏ chặn: %%A

&#x20;       ) else (

&#x20;           echo Không tìm thấy: %%A

&#x20;       )

&#x20;   )

&#x20;   echo Hoàn thành. Vui lòng kiểm tra file hosts.

&#x20;   pause

&#x20;   exit

) else (

&#x20;   echo Lựa chọn không hợp lệ. Thoát...

&#x20;   pause

&#x20;   exit

)

**Lưu ý:**

1\. Chạy tập tin batch này với quyền Administrator.

2\. File hosts nằm trong thư mục %SystemRoot%\System32\drivers\etc.

3\. Địa chỉ IP 127.0.0.1 sẽ chặn truy cập vào các địa chỉ Zalo.

4\. Để bỏ chặn, chọn tùy chọn 2.

**Cảnh báo:**

\- Việc sửa đổi file hosts có thể ảnh hưởng đến kết nối mạng.

\- Đảm bảo sao lưu file hosts trước khi thực hiện thay đổi.

\- Tập tin này chỉ hoạt động trên Windows.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://phantanloc.gitbook.io/locpt_wiki/homepage/2.it-cntt/code-dung-de-chan-zalo-tren-may-tinh-dung-winddows.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
