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 “Leave a reply” form at the bottom of this page.

Sincerely,

Shawn Tierney
Automation Consultant
Insights In Automation

Did you find my article helpful? Why not become a Premium Member with a small donation, and in return I'll give you a coupon for $10 of automation downloads! Find out more here

The Automation School – PAC Basics – Article Banner Top

Check Also

The Engineers Are Leaving

The Engineers Are Leaving – what to do before they do

The day has finally arrived.  FAT and SAT tests are complete.  All punch list items …

The Automation Blog's

The Automation Blog announces "guest blogging" support!

The Automation Blog is now open to guest bloggers! Why? Well, by allowing “guest bloggers” …

PLCs on workbench

Getting Started With Programmable Controllers (PLC)

I often get asked what is the best way to learn how to program PLC’s? …

Legacy Comments

  1. Pingback: The Automation Blog's "Best Of 2013" Miscellaneous blogs

  2. Pingback: Using Batch Files to change your PC's IP address

Leave a Reply