Tool to Manage Static Computer IP

I made a script to toggle between a set static IP and using DHCP in Windows. I hope it’s useful to someone.

You can always find the latest version at manitourobotics/tools/windows/

To setup:

  • Download and extract attached zip to this post
  • Install python2 if you don’t have it
  • Copy config.example.txt to config.txt and configure static_ip and interface_type
  • Create a shortcut to net-connect.bat by right-clicking on the file and clicking “Create Shortcut”
  • After creating the shortcut, right click on it and click properties. In the shortcut tab, click advanced… and check run as administrator(this program always needs to be run as admin). Click ok * 2
  • Drag shortcut to your start menu for fast switching


  • Rename config.txt.example to config.example.txt for easier renaming
  • Add Windows line endings to config.example.txt, so notepad doens’t display the file in one line


Oh yea! This will be great. I’ve had too many problems with our programmers forgetting to reset the IP settings, and too many noobs forget how to do it.



I did see those posts. I wanted something more flexible, and something requiring me to only click on one file(as in a toggle).

For some reason I can’t edit my posts. I made another tool that just shows network interface information.(I hate manually checking the Network adapter every time I’m curious about my current IP status) (1.48 KB) (1.48 KB)

You could just go Start->Run->type ‘cmd’ (usually already typed in since I almost certainly used it last) -> ipconfig /all

Same thing for the config. I used to write Batch and Perl scripts to do it, then I got lazy and just remembered the command to type (‘netsh interface ipv4 set address “Local Area Connection” static’). Roughly the same number of mouse strokes (which are highly more time-consuming than keystrokes), especially if I don’t have the folder with the batch file open or I’m not on my computer.

My best solution is to just use WiFi only for real networks, and use wired Ethernet only for robot networks. But, in case I have to break this, then I can just type netsh and be done.

But, if you do still want to do it this way, it should be possible to do entirely in a shell script, reducing dependencies on a foreign machine to zero.

You have a 24-hour window after posting to edit or delete. Think of it as a 24-hour-cure epoxy.

Along with Andrew’s info you should be able to achieve a toggling script by using an environment variable.

ipconfig /all shows interfaces I don’t care about. I really wanted a way to just show basic interface information that doesn’t make me hunt for the information.

With using script to toggle between static and DHCP, I remove any errors that I may make with signaling what static IP I want(which avoids IP address conflicts), and it saves time and patience for me.

Sometimes my team needs the robot to be using the wireless network for increased mobility(although I do generally use wired for the static internet-lacking network and wireless for internet access), and I use my personal computer to work on the robot, so, at the end of the day, I don’t want my wired interface to be set to a static IP.

I opted for python over solely batch(thus not reducing the dependencies to zero) because batch makes simple things like storing the output of a program into a variable painful. I honestly tried to use only batch, but I couldn’t bear using it after a point.

Using an environment variable sounds kind of hackish; the only way I could imagine being able to make a toggle of sorts would be to stuff practically a batch script into a variable that I execute. I really don’t want to use the command-line directly to execute my program because then I would have to worry about editing the path variable to where I store the batch files, and I would need to run the prompt as administrator to change my IP, and I would need to type in the program name, as to apposed to just hitting the windows key once, the down arrow key, and then enter as I have it now.

The work is done; feel free to use it or not.

Been a little curious about this, but haven’t gotten around to trying it yet, but can you simply enable DHCP and make reservations for the CRIO MAC address (and camera(s) if needed)?

Seems like an even nicer solution than the batch/script files (which are a huge improvement over manually switching). The only downside is lost learning opportunity for the kids doing it.

Save the router config once you do it, and reload the config after each match :slight_smile:


The driver station program should automatically set your computer’s IP for you when you start it up, as long as you’ve properly configured the team number and NIC. I don’t see the need for a different program to set the IP…

Our team decided it was easier to just have two network interfaces. We picked up cheap network cards (you can find them for ~$10 each) and simply added a second interface card to our lab computers. Set the static IP on the robot interface and DHCP on the other one.

Bonus tip: You can buy a short ethernet cable and a straight-through double female RJ45 connector to extend your ethernet jack out to the edge of our desk. Helps a lot if your computer sits back under the desk.

This is great.

Also you may use the 2CAN firmware utility to change ip’s and switch between static and DHCP.