Create folder named IP address for each PC
Posted: 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
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