Computing.Net > Forums > Programming > Batch Script Help

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch Script Help

Reply to Message Icon

Name: techhelp00
Date: March 15, 2007 at 14:55:00 Pacific
OS: Windows
CPU/Ram: 2.6/1GB
Product: Dell
Comment:

I need some help writing a batch script to do the following:

First check to see if Network connection is on DHCP. If it is, exit. If not, change the DNS Server IP address to specified static IPs.

This is what I have for changing the IP...I just don't know how to check for DHCP and exit if it is or continue if it is not DHCP.


netsh interface ip set dns name="Local Area Connection" source=static addr=192.168.1.1 register=PRIMARY
netsh interface ip add dns name="Local Area Connection" addr=192.168.1.2 index=2

netsh interface ip set dns name="Local Area Connection 2" source=static addr=192.168.1.1 register=PRIMARY
netsh interface ip add dns name="Local Area Connection 2" addr=192.168.1.2 index=2



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: March 15, 2007 at 16:42:39 Pacific
Reply:

Like the forum guidelines say, the EXACT OS will help.

This can be used in NT/XP:

ipconfig /all|find "DHCP" |find "Yes"
if errorlevel 1 goto :setIP
goto :eof
:setIP
:: here's where you do you thing


=====================================
If at first you don't succeed, you're about average.

M2



0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch Script Help

Batch Script Help Needed www.computing.net/answers/programming/batch-script-help-needed/14475.html

Simple Batch Script help www.computing.net/answers/programming/simple-batch-script-help/12744.html

Batch Script Help and Suggestions www.computing.net/answers/programming/batch-script-help-and-suggestions/14552.html