Simple Team Number to IP Address Utility

Ever wanted to set your computer’s IP so that you would be able to communicate with your robot, but didn’t want to hassle with all the dialogues required to do so in Windows? (Control Panel > Network Connections > Your Network Connection > Properties > Internet Protocol (TCP/IP) > Properties …what a bore!)
Well, I have a solution! teamtoip takes your team # and your network interface name, and automatically sets your IP address and subnet mask!

Command line usage:

teamtoip [team] "Interface Name"

Where [team] is your team number and “Interface Name” is the name of the interface you want to change the IP of. Generally it is “Local Area Connection” or “Wireless Network Connection” for wired Ethernet or wireless, respectively.

This utility was created mainly for inspectors at competitions, who have to change their IP address for each individual robot they inspect, which is quite inconvenient.

I am posting it here for 2 reasons:

  1. More eyes looking can catch more issues. If you find anything wrong with my code, or even anything that can be improved upon, don’t hesitate to email me.
  2. This will probably be useful to more than just inspectors. Team members who don’t like screwing around with network interface configuration (and don’t need the IP address to be set back to what it was before :wink: as well as people who don’t remember the IP address convention can use this.

So, without further ado, here is the program:

Binary [Windows]:

Simpler yet:

set /p teamnum=What is the team number?
set /a teamnumhigh=%teamnum%/100
set /a teamnumlow=%teamnum%-100*%high%
netsh interface ip set address 10.%high%.%low%.6 static 1

Put it in a batch file (e.g. teamip.bat) on your desktop, double-click, and enter the team number when prompted.

The netsh command is powerful. You can make single-line batch files to reconfigure the computer to talk to the Axis camera, or to make it easy to switch between (which will let the computer talk to any team’s WGA) and the WGA’s factory default address.

Aha! I knew there had to be an easier way!
I’ve made a batch file to perform the same task, with some improvements: after setting the IP address, you will be prompted for another team number and your old settings will be restored once you are finished.
Unfortunately it restores settings for all your network interfaces, not just the changed one. This takes quite a while for me (and my four network interfaces), but it will likely not take as long for others.

NOTE: Do not quit the batch file (by entering 0 as the team number) until you are ready to restore your settings. Also, if you quit using ctrl-c, the batch file will not restore your old settings if you run it again - It restores the settings from when the batch file was started.
EDIT: another note - don’t delete ifcfg.txt while the batch file is running - it will be deleted after the batch file is exited normally (by entering 0 as the team number).

Team # to IP script [Windows batch]:

Thanks for your help, Alan!

To keep from setting ALL your network interfaces, add the name parameter.
Here’s an example from team 67 and one that sets it back to dhcp for normal operations:

@netsh interface ip set address name=“Local Area Connection” source=static
addr= mask=

@netsh interface ip set address name=“Wireless Network Connection” dhcp
@netsh interface ip set address name=“Local Area Connection” dhcp