Solved

Dymanically adding an IP address to the end of a shortcut command line

Posted on 2015-01-28
1
105 Views
Last Modified: 2015-02-13
I have a program that runs the command below in the properties section of a shortcut. 10.10.10.1 is the IP address of the PC that the shortcut is running from however, the PCs will no longer have static addresses so I need to find a way to have the current IP address of the PC added to the end of this command dynamically. I was told to replace the IP address with %IP% but, that didn't work. Is there a way that I can have the current IP of the PC appended to this command line. The operating system is Windows 7

C:\dbcsc\dbcsc.exe 10.10.2.2  master -cfg=dbcdxl.cfg SMARTCLIENT DBC_PORT=  DBC_IP=10.10.10.1
0
Comment
Question by:jfholloway
1 Comment
 
LVL 32

Accepted Solution

by:
it_saige earned 500 total points
Comment Utility
You could use a batch to set an environment variable for the local ip and then set the 'DBC_IP=%whateverthevariablenameis%.

Something like:
@cls
echo off
FOR /F "tokens=4 delims= " %%i in ('route print ^| find " 0.0.0.0"') DO SETX LOCALIP %%i /M

Open in new window

In a batch produces the local ip in a system environment variable called LOCALIP.  You could then have the shortcut reference this:
C:\dbcsc\dbcsc.exe 10.10.2.2  master -cfg=dbcdxl.cfg SMARTCLIENT DBC_PORT=  DBC_IP=%LOCALIP%

Open in new window

The batch itself, could be called as part of a Machine Startup script or Login script.

-saige-
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Our Group Policy work started with Small Business Server in 2000. Microsoft gave us an excellent OU and GPO model in subsequent SBS editions that utilized WMI filters, OU linking, and VBS scripts. These are some of experiences plus our spending a lo…
NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.

743 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