Home / Microsoft / Microsoft DOS / Simple .bat file
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] - (Bottom) Print
Author Topic: Simple .bat file  (Read 1079 times)
set
Guest
« on: September 11, 2007, 02:46:39 PM »

Hi, as topic name said i need help making simple .bat file.
When it run it should edit this file...
C:\Windows\system32\drivers\etc\hosts
Can anyone post exemple?
IP logged
DeltaSlaya
Apprentice



Posts: 529



Google

« Reply #1 on: September 11, 2007, 03:09:46 PM »

How do you want it to be edited? Appending a line based on user input or what?
You haven't given much to go on.

What reason do you have for needing to do this?
IP logged

System specs:
Intel Core 2 Duo E6600 (up to 3.3 stock V and air)
ASUS Striker Extreme
XFX 8600GT XXX Edition
2x 1gB Corsair XMS2 DDR2-800
Seagate Barracuda 320gB SATA
Raidmax Ninja 918 (520W ATXV2.0 PSU)
-
set
Guest
« Reply #2 on: September 11, 2007, 03:50:51 PM »

when run,user need to see just this..not to type anything or do anything

Configuration to your hosts are changed successful.

Press any button to continue.

and i need this to change hosts. so it allow people to connect to lineage2 private server
IP logged
DeltaSlaya
Apprentice



Posts: 529



Google

« Reply #3 on: September 11, 2007, 10:16:06 PM »

@echo off

>>"C:\Windows\system32\drivers\etc\hosts" echo line you want to add

echo Configuration to your hosts are changed successful.
echo.
pause
IP logged

System specs:
Intel Core 2 Duo E6600 (up to 3.3 stock V and air)
ASUS Striker Extreme
XFX 8600GT XXX Edition
2x 1gB Corsair XMS2 DDR2-800
Seagate Barracuda 320gB SATA
Raidmax Ninja 918 (520W ATXV2.0 PSU)
-
set
Guest
« Reply #4 on: September 12, 2007, 03:47:02 AM »

thanks you...
now, i have only 1 qusetong, can it make to delete all exiting lines in that file, and insert new lines, that is given as command?
IP logged
Dark Blade
Forum Gaming Master
Adviser



Thanked: 24
Posts: 724

Experience: Experienced
OS: Windows XP

1
« Reply #5 on: September 12, 2007, 04:25:55 AM »

>"C:\Windows\system32\drivers\etc\hosts" echo line you want to add

Use only one redirection arrow (>)

IP logged

set
Guest
« Reply #6 on: September 12, 2007, 04:47:27 AM »

here
Code: [Select]
@echo off

COLOR 0A

>"C:\Windows\system32\drivers\etc\hosts" echo 127.0.0.1
>"C:\Windows\system32\drivers\etc\hosts" echo 89.149.200.219 l2authd.lineage2.com
>"C:\Windows\system32\drivers\etc\hosts" echo 89.149.200.219 l2testauthd.lineage2.com


echo Configuration to your hosts are changed successful.
echo.
pause


and when i run it it create only last line?
this
Code: [Select]
89.149.200.219 l2testauthd.lineage2.com
IP logged
Dark Blade
Forum Gaming Master
Adviser



Thanked: 24
Posts: 724

Experience: Experienced
OS: Windows XP

1
« Reply #7 on: September 12, 2007, 04:51:33 AM »

Oh, I didn't realise that you were doing multiline.

Only use one redirection arrow for the first line, but 2 for all the rest, like below:

@echo off

COLOR 0A

>"C:\Windows\system32\drivers\etc\hosts" echo 127.0.0.1
>>"C:\Windows\system32\drivers\etc\hosts" echo 89.149.200.219 l2authd.lineage2.com
>>"C:\Windows\system32\drivers\etc\hosts" echo 89.149.200.219 l2testauthd.lineage2.com


echo Configuration to your hosts are changed successful.
echo.
pause
IP logged

set
Guest
« Reply #8 on: September 12, 2007, 05:01:12 AM »

thx dude :D
IP logged
Pages: [1] - (Top) Print 
Home / Microsoft / Microsoft DOS / Simple .bat file « previous next »
 


Login with username, password and session length

Old Forum Search | Forum Rules
Copyright © 2010 Computer Hope ® All rights reserved.
Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
Page created in 0.073 seconds with 20 queries.