adding a port entry into c:\windows\system32\drivers\etc\services

I am writing a batch file to bring together the various exe running and file copy procedures of installing an application. One of the stages involdes adding the entry ;
esri_sde 5151/tcp        #Reference to Grouch SDE
at the end of c:\windows\system32\drivers\etc\services
Is there a simple way of scripting this?
LVL 1
SYPTE-ITAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Steve KnightConnect With a Mentor IT ConsultancyCommented:
Or better to deal with c:\winnt, c:\windows etc:

@echo off
set services="%SystemRoot%\system32\drivers\etc\services"
find "esri_sde" %services% || echo esri_sde 5151/tcp        #Reference to Grouch SDE >> %services%

That will check using find if the entry is in services and if not add it.

Steve
0
 
OrenRozenConnect With a Mentor Commented:
hi,

the command is :

echo esri_sde 5151/tcp        #Reference to Grouch SDE >> services

0
 
OrenRozenConnect With a Mentor Commented:
another thing, to do the same for every location changes services to the full path:
C:\Windows\System32\drivers\etc\services

thanks.
0
 
SYPTE-ITAuthor Commented:
Thanks, so much more simple than all those C## etc scripts I found with google!
0
 
Steve KnightIT ConsultancyCommented:
No problem... obviously it will need to be run with suitable admin rights to the file... but easy is good in my eyes!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.