Go Back   Computer Forums > General Computing > Hardware
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 07-03-2009, 03:30 PM   #1
Solid State Member
 
Join Date: Jun 2009
Posts: 19
Default How can i add text to a host file through cmd?

I just want to add (example):


127.0.0.1 localhost
127.0.0.1 google.com

to my host file - windows\sytem32\drivers\etc\hosts

through cmd, how can i do this?
__________________

shrshr429 is offline   Reply With Quote
Old 07-03-2009, 03:45 PM   #2
Daemon Poster
 
Join Date: Jun 2004
Posts: 511
Send a message via AIM to Denthúl Send a message via MSN to Denthúl Send a message via Yahoo to Denthúl
Default Re: How can i add text to a host file through cmd?

Code:
echo >> 127.0.0.1 google.com C:\windows\sytem32\drivers\etc\hosts
That might work for you. I don't remember if the 'hosts' file is a text file or something else in Windows, though. Best thing to do is create a copy of your hosts file and test it on that first.

Out of interest, is there a reason you want to do this?

Edit: Whatever you do, don't miss out one of the less-than signs. If you were to do the following:

Code:
echo > 127.0.0.1 google.com C:\windows\sytem32\drivers\etc\hosts
It would add 127.0.0.1 google.com to the file, but would delete everything else in there first (assuming that it works at all).
__________________

Denthúl is offline   Reply With Quote
Old 07-03-2009, 03:50 PM   #3
Solid State Member
 
Join Date: Jun 2009
Posts: 19
Default Re: How can i add text to a host file through cmd?

to Add this:

# Start of entries inserted by Spybot - Search & Destroy
127.0.0.1 www.007guard.com
127.0.0.1 007guard.com
127.0.0.1 008i.com
127.0.0.1 www.008k.com
127.0.0.1 008k.com
127.0.0.1 www.00hq.com
127.0.0.1 00hq.com
127.0.0.1 010402.com
127.0.0.1 www.032439.com
127.0.0.1 032439.com
127.0.0.1 www.0scan.com
127.0.0.1 0scan.com
127.0.0.1 www.1000gratisproben.com
127.0.0.1 1000gratisproben.com
127.0.0.1 www.1001namen.com
127.0.0.1 1001namen.com
127.0.0.1 100888290cs.com
127.0.0.1 www.100888290cs.com

..........

Prevent spyware on my comp.
shrshr429 is offline   Reply With Quote
Old 07-03-2009, 03:52 PM   #4
Daemon Poster
 
Join Date: Jun 2004
Posts: 511
Send a message via AIM to Denthúl Send a message via MSN to Denthúl Send a message via Yahoo to Denthúl
Default Re: How can i add text to a host file through cmd?

Oh, I see. Does Spybot generate that in a text file or is it displayed within the application itself?
Denthúl is offline   Reply With Quote
Old 07-03-2009, 03:59 PM   #5
Solid State Member
 
Join Date: Jun 2009
Posts: 19
Default Re: How can i add text to a host file through cmd?

Didn't work, nothing happened.

Generated that in a text file.
shrshr429 is offline   Reply With Quote
Old 07-03-2009, 04:05 PM   #6
Daemon Poster
 
Join Date: Jun 2004
Posts: 511
Send a message via AIM to Denthúl Send a message via MSN to Denthúl Send a message via Yahoo to Denthúl
Default Re: How can i add text to a host file through cmd?

Somehow I thought it wouldn't. :/

I'll keep looking in to it for you, but I don't have a Windows machine to test it on, so I can't say whether or not something would work. It might end up being easier if you altered the file using a text editor of some kind. Or using a script (though that script might have to first rename the file with the .txt extension, then write to it, then remove .txt) of some kind.
__________________

Denthúl is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 02:29 PM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0