Solved

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

Posted on 2011-03-03
5
2,198 Views
Last Modified: 2012-05-11
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
Comment
Question by:SYPTE-IT
  • 2
  • 2
5 Comments
 
LVL 3

Assisted Solution

by:OrenRozen
OrenRozen earned 125 total points
ID: 35028846
hi,

the command is :

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

0
 
LVL 3

Assisted Solution

by:OrenRozen
OrenRozen earned 125 total points
ID: 35028864
another thing, to do the same for every location changes services to the full path:
C:\Windows\System32\drivers\etc\services

thanks.
0
 
LVL 43

Accepted Solution

by:
Steve Knight earned 125 total points
ID: 35028913
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
 
LVL 1

Author Closing Comment

by:SYPTE-IT
ID: 35028952
Thanks, so much more simple than all those C## etc scripts I found with google!
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 35029090
No problem... obviously it will need to be run with suitable admin rights to the file... but easy is good in my eyes!
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Can I legally transfer my OEM version of Windows to another PC?  (AKA - Can I put a new systemboard in my OEM PC?) Few of us are both IT and legal experts but we all have our own views of Microsoft's licensing rules and how they apply.  There are…
Ok I have been working on this for some time having learned and gained certification in XenDesktop 4 along came version 5 which was released last month. Since then I have been working to deploy XenDesktop 5 in a small environment with only 2 virt…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video discusses moving either the default database or any database to a new volume.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now