Using Batch Files to change your PC’s IP address


IP BAT Files Featured ImageIt’s Friday and in this TGIF edition of “The Automation Blog” I want to share a little trick I learned from Darrell Clark while visiting his site last week.

Most of us in the industrial automation world connect to our company (or home) network using DHCP. But we also need to connect to our automation device networks via static IP address, resulting in many trips to the control panel to change our IP address settings.

But when you have multiple systems it becomes challenging to remember what IP address settings you need for each system.

To address this Darrell created several batch files that, when “double clicked,” change his Windows XP system’s IP address settings to match the system he needs to connect to. This not only saves him the time required to manually change these settings in the control panel, it also helps his colleagues (who connect less often) quickly chose the right IP address settings for the many systems they need to connect to.

Below I’ll paste in the contents of two of Darrell’s batch files which he was kind enough to share with our readers. The first is used for connecting in his office network via DHCP, and the second is used to connect to one of his automation systems (I’ve edited the text of the second file to remove the actual system’s IP address settings.)

Setup DHCP in WindowsXPOffice Network (DHCP) Batch File contents:

Text File name:

Office LAN Network Settings.bat

Text File Contents:

@ECHO OFF

ECHO This file is brought to you by DARRELL CLARK!

ECHO Resetting IP Address and Subnet Mask For DHCP netsh int ip set address name = “Local Area Connection” source = dhcp

ECHO Here are the new settings for %computername%: netsh int ip show config

pause

Windows XP Static IPAutomation System Batch File contents:

Text File name:

Automation System 1 Network Settings.bat

Text File Contents:

@ECHO OFF

ECHO This file is brought to you by DARRELL CLARK!

ECHO Resetting IP Address and Subnet Mask For ********* automation system

netsh interface ip set address name=”Local Area Connection” source=static addr=192.168.100.2 mask=255.255.255.0

ECHO Here are the new settings for %computername%: netsh int ip show config

pause

To use the above text in a batch file on Windows XP, simply copy the text and paste it into Notepad. Then change the settings to match your requirements and save the file with a name which represents your system and ends with the .BAT file extension.

I hope Darrell’s batch files can be of some help for you. Admittedly, they are written for a Windows XP system so if you’ve created similar batch files for Windows 7 we’ve love to hear from you! You can leave your comments to this article by using the “post a comment or question” link below.

Until next time, Peace ✌️ 

If you enjoy this episode please give it a Like, and consider Sharing as this is the best way for us to find new guests to come on the show.

Shawn M Tierney
Technology Enthusiast & Content Creator

Eliminate commercials and gain access to my weekly full length hands-on, news, and Q&A sessions by becoming a member at The Automation Blog or on YouTube. You'll also find all of my affordable PLC, HMI, and SCADA courses at TheAutomationSchool.com.

shawntierney avatar


Discover more from The Automation Blog

Subscribe to get the latest posts sent to your email.

4 COMMENTS