Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2011-03-03
5
Medium Priority
?
2,763 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 500 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 500 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 500 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

782 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