Computer Hope
Microsoft => Microsoft DOS => Topic started by: plm on April 06, 2009, 06:02:53 AM
-
Hi Computerhope
I am trying to make a batch script that takes the list of Ip adresses from A.txt and appends it to B.txt with the following command:
type B.txt>>A.txt
content of A.txt:
10.20.30.40
50.60.70.80
content of B.txt
1.2.3.4
5.6.7.8
But how do i make sure that the ip adresses from B.txt are being inserted in the bottom of the A.txt file (makes a new line). My A.txt ends up looking like this:
10.20.30.40
50.60.70.801.2.3.4
5.6.7.8
Bets regards plm
-
Why do you want to add it to the hosts file?
-
Oh goodie ;D, with a file of IP Addresses you could use those to chat in school (trust me, I know how it's done)
-
/removed
-
/removed
-
/removed
-
Sorry guys, I removed your suggestion. I would like to know why Plm needs to do this.
-
I would like to know why Plm needs to do this.
i would like to know why you removed them.
-
You want him, and the entire world, to know how to add IP address into the Hosts file?
Do you know what that could do?
-
You want him, and the entire world, to know how to add IP address into the Hosts file?
Do you know what that could do?
aren't you being too sensitive? he asked a legit question on how to append to files properly. Adding ip address to hosts files is just common practice anyway among system administrators. Until proven guilty, everyone is innocent.
-
Re: batch script Adding Ip adresses to hosts file
Nice title.
Anyways, this is a public forum. anyone can view the information posted here. Perfect for pranksters, eh?
-
Nice title.
so ?
Anyways, this is a public forum. anyone can view the information posted here. Perfect for pranksters, eh?
wow, why don't you remove the suggestions from the thread that that says "how to read target from shortcut (http://www.computerhope.com/forum/index.php/topic,80659.0.html)"? Do you know what would happen if a prankster changes something in that shortcut that tries to delete an important file(for example) if double clicked?
-
Sorry guys, I removed your suggestion. I would like to know why Plm needs to do this.
no problem, i don't know if hosts file should not be edited.
-
No point in arguing.
I have had hands-on experiencing regarding Hosts file edits. A friend created a batch file that redirected popular URLs to a website I need not mention here. He ran this batch file on several of the laptops in my class and caused a great deal of trouble in the lesson.
None of them knew how to undo this. They didn't know where the problem lay, nor did they know what the Hosts file was.
I asked Plm 'why he wanted to do this', and BatchFileCommand concurred with my assessment.
You went ahead and posted the potentially harmful information anyways.
Read the forum rules under Causing users grief / hacking.
You should be glad I didn't simply delete your posts and offer no reason why I did it.
-
no problem, i don't know if hosts file should not be edited.
This Hosts file can be edited. It is edited in some situations. But take note that many viruses modify the Hosts file just to cause trouble. Large networks have special programs to monitor network traffic and block sites.
Imagine trying to get to www.google.com but being transferred to a site to buy a fake antivirus that steals sensitive information from your computer.
-
you are posting some information on how a host file could be "mis-used". could you delete this whole thread?
No point in arguing.
I have had hands-on experiencing regarding Hosts file edits. A friend created a batch file that redirected popular URLs to a website I need not mention here. He ran this batch file on several of the laptops in my class and caused a great deal of trouble in the lesson.
None of them knew how to undo this. They didn't know where the problem lay, nor did they know what the Hosts file was.
I asked Plm 'why he wanted to do this', and BatchFileCommand concurred with my assessment.
You went ahead and posted the potentially harmful information anyways.
Read the forum rules under Causing users grief / hacking.
You should be glad I didn't simply delete your posts and offer no reason why I did it.
-
No, I don't believe this should be deleted. In fact, I just wanted to know what Plm is trying to accomplish, which was my initial question......
-
No point in arguing.
I have had hands-on experiencing regarding Hosts file edits. A friend created a batch file that redirected popular URLs to a website I need not mention here. He ran this batch file on several of the laptops in my class and caused a great deal of trouble in the lesson.
None of them knew how to undo this. They didn't know where the problem lay, nor did they know what the Hosts file was.
I asked Plm 'why he wanted to do this', and BatchFileCommand concurred with my assessment.
You went ahead and posted the potentially harmful information anyways.
Read the forum rules under Causing users grief / hacking.
You should be glad I didn't simply delete your posts and offer no reason why I did it.
i definitely DO NOT AGREE with you. He can jolly well edit the host file and type in (or copy and paste) the ip addresses himself, wouldn't he? you have made a ridiculous assumption, however seeing you as the superior being here, i will rest my case.
-
Creating the batch file will make it easier for him to use it on other computers, eh?
Anyways, this is a hypothetical situation...
-
Creating the batch file will make it easier for him to use it on other computers, eh?
Anyways, this is a hypothetical situation...
yeah right, the key word is hypothetical. you wouldn't know what he's going to do. maybe he is a legit system admin. therefore, its not right to do what you did.
-
And if his intentions were bad? ::)
-
And if his intentions were bad? ::)
how would you know? so if he were to rephrase his question (or title) without the ip address and host file, but just some example text and file names and ask how to append properly, would you still suspect him of anything?
-
Not at all, but that avoids my question.
No point continuing further. I am ending this now.
If you have any other questions or a response, please PM me.
-
An astute sys admin will use file permissions so that limited users cannot alter the Hosts file, and will keep a known good backup.
-
Hi CDO
I am about to make sure that some hundred monitored servers can send their snmp traps to some newly added monitoring servers during an upgrade. I have no intention of any malicious acts. I am a virgin into scripting so i thought that the experts on batch scripting on this site might be able to get me started.
best regards plm
-
the funny thing is if plm had asked how to append data to a text file there would have been no issues.
-
Why do people paid to know how to do sys admin come here to find out how to do their jobs?
-
You would want software to do this....Not a Hosts file edit....
-
You would want software to do this....Not a Hosts file edit....
come on, what are talking about?
-
the funny thing is if plm had asked how to append data to a text file there would have been no issues.
this is what i said in post #21.
-
Hi CDO
I am about to make sure that some hundred monitored servers can send their snmp traps to some newly added monitoring servers during an upgrade. I have no intention of any malicious acts. I am a virgin into scripting so i thought that the experts on batch scripting on this site might be able to get me started.
best regards plm
since you have spoken , here's a link (http://www.netikka.net/tsneti/info/tscmd163.htm) for your reference.
-
come on, what are talking about?
I am talking about network-administration software.
-
I see this as an excuse to get post-count up.
Carbon said that the code that we could have given could have been used for malicous purposes. It may not be the OP, but like he said, this is a public forum. ANYONE could see/use it.
OP, if you are a sys admin, then you should at least have enough knowledge of computers to make your own easy way to do what you first posted.
-
@plm, reply #30 is what you need to get you started. check it out and see if it works for you.
Or, if you have no restriction to download gawk for windows(see my sig)
C:\test>gawk "1" file1.txt file2.txt
10.20.30.40
50.60.70.80
1.2.3.4
5.6.7.8