• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3017
  • Last Modified:

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?
0
SYPTE-IT
Asked:
SYPTE-IT
  • 2
  • 2
3 Solutions
 
OrenRozenCommented:
hi,

the command is :

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

0
 
OrenRozenCommented:
another thing, to do the same for every location changes services to the full path:
C:\Windows\System32\drivers\etc\services

thanks.
0
 
Steve KnightIT 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
 
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.

Join & Write a Comment

Featured Post

Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now