I need a batch file to add a record to hosts file in windows, however I do not need just a file append writing because I would like to check if this record is already present. Is it possibile?
type "%SystemRoot%\system32\drivers\etc\hosts" | find "my_record" ||echo my_record>>"%SystemRoot%\system32\drivers\etc\hosts"
try this.You'll need administrator permissions to add something in hosts file