Script syntex

  • Thread starter Thread starter Max
  • Start date Start date
M

Max

I'm trying to insert a line into the 'hosts' file from the
login script that runs from the server when a user log's
in. How can I accomplish that?
 
what if the line is already there? do you still want it to put the new line
in there?

one way would be:

echo "10.10.10.10
somehost.network.com">>%systemroot%\system32\drivers\etc\hosts *

* noteAssuming the path to hosts is correct on EVERY machine.....

because the >> tells it to append to the end of the file.

Checking for the presense of the line would go like this (syntax not
accurate)

if (hosts | find /c /i "10.10.10.10") = 0 then
echo "10.10.10.10 somehost.network.com"
else
next

or something....

I can show you how to do it with perl, but you probably want it done in
batch. Cant really help with that.

NuTs
 
try asking in the .public.win2000.cmdprompt.admin group... the wizards hang
out in there.

NuTs
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top