|I want to update the whole content of hosts file with a text file (data1.txt) by running a batch (.bat) file. Please help.|
Actually my hosts file is pretty simple with just one line:
I have two conditions for which I need to add two different lines of the form shown below, right after the above line.
10.xxx.xx.x1 server_1_name #comment_1
(OR) - [this is condition dependent]
10.xxx.xx.x2 server_2_name #comment_2
I will create two batch files for server_1 and server_2 and two text files with the contents of the hosts file for the two conditions(data1.txt and data2.txt); So when I run the batch file for server_1, only that entry gets entered into the hosts file; and the same for server_2.
For the above condition, please help with the script for the bacth file.
Also, please let me know if there is a better way to do it, instead of creating the data files. I might have to do checking for existing text - where I came into problems with checking for spaces.