Solved

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

Posted on 2011-03-03
5
2,236 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Can you find a fax from a vendor you saved a decade ago in seconds? Have you ever cursed your PC under your breath during an audit because you couldn’t find the requested statement or driver history?  If you answered no to the first question or yes …
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

920 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

16 Experts available now in Live!

Get 1:1 Help Now