need just 3 oct of pc ip and put in bat file new x.x.y.x

October 30, 2012 at 11:07:34
Specs: Windows 7 and xp
need just 3 oct of pc ip and put in bat file new x.x.y.x

ex :: start "" "c:\fold\app.exe new -#.#.y.#


See More: need just 3 oct of pc ip and put in bat file new x.x.y.x

Report •


#1
October 30, 2012 at 12:30:01
First you need to specify where the ip is to come from, and where the replacement ("y") portion is to come from.

Report •

#2
October 30, 2012 at 13:20:34
the ip of the pc
Y= what need to be in the cmd string to get the sunbnet
ex 192.186.y.1 so if y = 5

need to but 5 in to a start cmd for a new ie window 192.168.5.2(start c:\fold\app.exe 192.168.1.5)
so the the bat file will work on all my subnets


Report •

#3
October 30, 2012 at 17:32:16
Here's something to start with:

setlocal
if "%1" equ "" (echo need subnet from commandline & goto :eof)
for /f "tokens=4,5,7 delims=. " %%a in ('ipconfig ^| find /i "ip address"') do set subnet=%%a.%%b.%1.%%c
echo subnet ip: %subnet%
::==== end

This assumes there is only one "ip address" delivered by the ipconfig.
I'm not familiar with subnets, so i'm unsure where to obtain that value from. You would be more knowledgable than me about that aspect. Ipconfig?

@mike: yeh, not sure. I did notice something with commandline, so I edited this to use commandline argument #1 for source.


Report •

Related Solutions

#4
October 31, 2012 at 06:46:47
looking at the origional post, and seconds, I believe the only thing the poster needs is to set the %y%.

so he is looking to do this (I think)

setlocal

for /f "tokens=6 delims=. " %%a in ('ipconfig ^| find /i "ip address"') do start "" "c:\fold\app.exe new -192.168.%%a.2 
echo subnet ip: %subnet%
::==== end

:: mike


Report •

Ask Question