Add an entry to Windows Host file programmatically (using command line)

Many times there is a need to automate amendments to windows host files. Following is an example of adding a line to Windows Host file programmatically, using Windows command line.
Executing following command in Windows command line box:
echo >> %WINDIR%\System32\Drivers\Etc\Hosts

, will append the following line to Windows host file and save it:


Facebook Comments