How to edit hosts file via CMD? [closed]
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . Hello I'd like to block some websites directly from the command prompt. echo like this: 0.0.0.0 websitename.com How can I do this? (OS: Windows 7) 回答1: echo 0.0.0.0 websitename.com >> %WINDIR%\System32\Drivers\Etc\Hosts the >> appends the output of echo to the file. Note that there are two reasons this might not