I want to add a host entry inside C:\Windows\System32\drivers\etc\hosts file. Is it possible with Visual Studio Set Up Project?
I have also tried with Wix with the following but not working?
<CustomAction Id='ExecAddHostEntry'
Directory="INSTALLDIR"
Execute="deferred"
ExeCommand='cmd.exe /k "@echo off & SET NEWLINE=^& echo. & FIND /C /I """a.com""" %WINDIR%\system32\drivers\etc\hosts ^& ^ IF %ERRORLEVEL% NEQ 0 ^& ^ ECHO %NEWLINE%^ 127.0.0.1 a.com>>%WINDIR%\System32\drivers\etc\hosts ^& ^ exit"' Return="check" Impersonate="no">
</CustomAction>
Update: cmd.exe /Q /C "find /I """a.com""" aa > nul || echo/& echo 127.0.0.1 a.com>>aa" command helped me