Create folder named IP address for each PC

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
ztahie
Posts: 2
Joined: 21 Apr 2011 01:59

Create folder named IP address for each PC

#1 Post by ztahie » 21 Apr 2011 02:09

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

!k
Expert
Posts: 378
Joined: 17 Oct 2009 08:30
Location: Russia

Re: Create folder named IP address for each PC

#2 Post by !k » 21 Apr 2011 07:04

try findstr /r /c:"IP.* Address" instead find

ztahie
Posts: 2
Joined: 21 Apr 2011 01:59

Re: Create folder named IP address for each PC

#3 Post by ztahie » 22 Apr 2011 08:13

thanks for the tip :) !!

works great

cherilyn
Posts: 2
Joined: 14 Jul 2011 00:13

Re: Create folder named IP address for each PC

#4 Post by cherilyn » 20 Jul 2011 04:35

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
Last edited by cherilyn on 24 Jul 2011 01:04, edited 1 time in total.

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: Create folder named IP address for each PC

#5 Post by Ed Dyreen » 20 Jul 2011 09:51

'
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!

Post Reply