Monthly Archives: January 2008

Configure Windows XP Network Settings from the Command Line

Once upon a time batch files were king in the PC world. Hardly a magazine issue, BBS discussion or user group meeting would go by without one of these handy scripts to add some functionality or usability to systems. Since the reign of Windows batch file programming has been on the decline. Of course shell scripting remains popular and extremely popular in Linux where most settings on the system are still controlled by text configuration files and command line utilities but in Microsoft land the script has been largely supplanted.

Even though the NT based operating systems (NT, 2000, XP, etc.) have actually made significantly more configuration available from the command line and there was a push for a new ‘Windows Scripting’ language these things have become largely forgotten and there are now an extremely limited number of users comparable to the Windows operating population which are comfortable writing scripts to automate things in Windows. Even among large corporate IT departments where there is perhaps the most to be gained by writing these sort of mini-utilities scripting is a dying art. One of the reasons for this is that most magazines and technical publications no longer regularly mention scripting or command line configuration utilities so there is a limited opportunity to learn about these tools.

Nevertheless these tools exist and when you find them they can be extremely useful. Take the “netsh” program for example. This handy little tool allows you to set and manipulate many of the Windows network settings from the command line and when combined with scripting it is possible to create scripts which will completely reconfigure your network interfaces (say from DHCP to a static address to another static address) for various network configurations all with the simple execution of a script.

You can learn more about this powerful tool from a few different Microsoft sites but while these provide some syntax and information perhaps the best place to get started is at one of the third party sites which covers it. Or now that you know about the utility you could just start experimenting with things.

For example running the “netsh -c interface dump” command will dump all kinds of interesting information about how your interfaces are currently configured to the prompt. It’s possible to capture this information to a text file and then ‘replay’ the data to reconfigure things as they currently are using something like “netsh -f netsettings.txt”

Keep the art alive!