Solved Subnet mask to variable for batch file

September 4, 2015 at 08:04:15
Specs: Windows 7

To cut a long story short I need to get just the subnet mask on its own to a variable I can use in DOS

I can get the ip address on its own but need the mask also I need to feed these values to other parts of the batch file

How would I even display the mask on its own? I have searched about and nearest I came was the netsh command.

I need to isolate the subnet mask.

Hope someone has a idea?



See More: Subnet mask to variable for batch file

Report •

September 4, 2015 at 09:02:58
✔ Best Answer
Try this:
for /f "tokens=2,* delims=:" %%A in ('ipconfig ^| find "Subnet"') do set subnet=%%A
set subnet=%subnet:~1%

To display, use

Echo %subnet%

99 little bugs in the code,
99 little bugs.
Take one down, patch it around,
129 little bugs in the code.

message edited by RainBawZ

Report •

September 4, 2015 at 15:05:38
Thanks work perfectly

Thank you


Report •
Related Solutions

Ask Question