Page 1 of 1

Create folder named IP address for each PC

Posted: 21 Apr 2011 02:09
by ztahie
Hi !
I'm looking for your tips...
I created a bat file that create a folder.
the name of the folder "copied" from the local IP Address of the PC.
this is the bat file:
----------------
ipconfig /all > tempIP.txt
for /F "tokens=2 delims=:" %%j in ('ipconfig ^| find "IP Address"') do set Host=%%j
set Host=%Host:~1%
ren tempIP.txt "%Host%.txt"
------------------
my problem is that I search for a spesific key "IP Address" that compatible for windows XP \ 2003 only.
but if I want to run this bat file in windows 2008 OS, the key must be changed to "IPv4 Address".

I dont want to have 2 bat files ,each for diffrent OS.
how can I create one file that compatible for diffrent OS?

Thanks

Re: Create folder named IP address for each PC

Posted: 21 Apr 2011 07:04
by !k
try findstr /r /c:"IP.* Address" instead find

Re: Create folder named IP address for each PC

Posted: 22 Apr 2011 08:13
by ztahie
thanks for the tip :) !!

works great

Re: Create folder named IP address for each PC

Posted: 20 Jul 2011 04:35
by cherilyn
How do you change a computers IP address? Ive recently converted to wireless internet and have had an error saying that someone with my IP address is already on the network,that if i do not fix it,i could have internet connectivity problems.I am unsure of how to change my IP address though. A friend of mine said its not possible to change your IP.
___________________________
affiliateelite ~ affiliateelite.com

Re: Create folder named IP address for each PC

Posted: 20 Jul 2011 09:51
by Ed Dyreen
'
Hi cherilyn, not really related to @ztahie's question. Next time create a new topic maybe. :)
How do you change a computers IP address?
example:

Code: Select all

set "Netsh.Name____=LAN-verbinding"
set "Netsh.Source__=static"

set "Netsh.Address_=!IP.NET.Address!.30"
set "Netsh.Mask____=255.255.255.0"
set "Netsh.Gateway_=!IP.NET.Address!.1"
set "Netsh.Gwmetric=1"
::
echo.  Netsh.Name    : !Netsh.Name____!
echo.  Netsh.Source  : !Netsh.Source__!
echo.
echo.  Netsh.Address : !Netsh.Address_!
echo.  Netsh.Mask    : !Netsh.Mask____!
echo.  Netsh.Gateway : !Netsh.Gateway_!
echo.  Netsh.Gwmetric: !Netsh.Gwmetric!
::
netsh interface ip set ^
address name="!Netsh.Name____!" ^
source=!Netsh.Source__! ^
addr=!Netsh.Address_! ^
mask=!Netsh.Mask____! ^
gateway=!Netsh.Gateway_! ^
gwmetric=!Netsh.Gwmetric!