type "%SystemRoot%\system32\drivers\etc\hosts" | find "my_record" ||echo my_record>>"%SystemRoot%\system32\drivers\etc\hosts"
试试这个.您需要管理员权限才能在hosts文件中添加内容