Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
I'm creating a batch file which at one point should put the machine's TCP/IP address into a variable. If this were a system variable, it would be easy.
I'm using Windows 2000, so I already have variables such as USERDOMAIN, USERNAME, COMPUTERNAME. However, it would be most helpful if I could also get the TCP/IP address and the subnet mask information in there as well.
I'm aware this information can come from IPCONFIG. But how do I get just the numbers?
Name: Secret_Doom Date: August 1, 2002 at 14:20:00 Pacific
Reply:
This works for WinXP, should also work on Win2K:
@echo off IPCONFIG |FIND "IP" > %TEMP%.\TEMP.DAT FOR /F "tokens=2 delims=:" %%a in (%TEMP%.\TEMP.DAT) do set IP=%%a del %TEMP%.\TEMP.DAT set IP=%IP:~1% echo IP=%IP%
Summary: FOR command introduced in Ver 2.0 If used in batch file,use the following: FOR %%variable IN (set) DO comand If used at DOS prompt, use : FOR %variable IN (set) DO command Syntax Options: %variable......
Summary: Use the command CALL to invoke that another batch file: for %%f in (*.dll) do call somebat %%f -- Leonardo Pignataro - Secret_Doom -- secret_doom@hotmail.com www.batch.hpg.com.br ...
Summary: Bitbyte's SCALC.COM is a great program, useful on batch files under DOS/Win9x. However, in NT systems such as Win 2000, the command prompt itself can do all it does (and much more). Here's a sample: s...