IP address variable

H

Henry

Hi
I need to use the local ip address of a server in a
script. This script will run on various servers so I need
to get the variable or some method of getting this into
the script. Any ideas....?
 
J

Jerold Schulman

Hi
I need to use the local ip address of a server in a
script. This script will run on various servers so I need
to get the variable or some method of getting this into
the script. Any ideas....?

See tip 7390 in the 'Tips & Tricks' at http://www.jsiinc.com

for /f "Tokens=2 Delims=[]" %%i in ('ping -n 1 "%computername%"') do set IP=%%i

If you type this, instead of placing it in a script, replace %% with %.



Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top