Editing your host file using the Command Prompt (CMD) is a fairly simple process. One of the primary reasons to edit your host file is to block a website/domain from connecting to your computer/network. Here are the steps to edit the host file in CMD:
Open the Command Prompt with Administrator privileges by right-clicking on its shortcut and select Run as administrator.
Type in the following command:
notepad c:\Windows\System32\drivers\etc\hosts
This will open up the host file in Notepad.
Now add the website/domain you want to block by typing in the following syntax:
127.0.0.1 www.example.com
If you want to block multiple websites/domains, just add them one per line below the first.
After you’re done editing, save the file and exit Notepad.
That’s it – you have successfully edited your host file using the CMD.