View Single Post
Old 02-16-2012, 05:03 PM
zementmischer zementmischer is offline
Join Date: Apr 2011
Location: Europe
Posts: 43

Sorry aladdin, but your statement somewhat implies that my batch file isn't working at all.

Did you even bothered to try and see if it works?

Furthermore your 'googled' batch file doesn't even meet your posted requirements ("it should ask in the following order") - hence, it's definitely NOT 100% WORKING. Or did I missed a RFC (Request for Change) somewhere?

Nevertheless you can improve the perfomance of the batch file by combining the first and second call to netsh.exe.

Here's the code - just in case that you don't have the faintest idea of CLI (did you ever made a batch file yourself?)
SET adapter="Local Area Connection"
SET ipaddr=
SET subnet=
SET gateway=
SET pridns=
SET secdns=
netsh interface ip set address %adapter% static %ipaddr% %subnet% %gateway% 1 >NUL
netsh interface ip set dns %adapter% static %pridns% >NUL
netsh interface ip add dns %adapter% %secdns% index=2 >NUL
netsh interface ip show config %adapter%
Real programmers don't comment their code.
If it was hard to write, it should be hard to read.
Reply With Quote