Creating Batch Files and Using them to Schedule Windows Maintenace Tasks

One of the most effective ways to use command line utilities on a Windows XP system is to add them to a batch file, and then schedule them to run automatically using the Scheduled Tasks tool in Control Panel. Going back to the days of MS-DOS, users have used simple batch files to automate everything from defragmenting a hard disk to doing backups with a utility like XXCOPY.

If you’re not familiar with how batch files work, the good news is that on a basic level, they couldn’t be easier. Think of a batch file as a text file that contains a series of command line statements, such as a command followed by switches. Each command is placed on its own line, and will execute according to the parameters you provide. For example, if you placed the command DEFRAG c: /F into a text file, and then saved the file with a .BAT extension, this command would execute every time you double-clicked on the file.

Scheduling a batch file to run automatically is as simple as walking through the Scheduled Task Wizard accessible in the Scheduled Tasks applet in Control Panel. Schedule your batch files to run automatically according to your needs, and then never worry about manually maintaining your system again!

Connecting to Systems Remotely with TELNET

Last but not least, take a closer look at the TELNET command. This command allows you to remotely connect to a server running the Telnet service, and then interact with it as though you were sitting at the command line of that system.

This is a wonderful tool to interact with remote systems, such as those running Linux or Unix, as many Internet servers do. In order to log on to a server via Telnet you’ll need an account configured on that system, as well as some understanding of the remote system’s command line environment.

Tracing Network Communications with the TRACERT Command

In cases where you don’t need the detailed information that PATHPING provides in generating diagnostic information about the route between your PC and a destination host, try the TRACERT command. TRACERT literally traces the path between a source and destination host, showing you which intermediate routers are traversed on the journey.

This command is much quicker than PATHPING, but provides critical information about how long the delay is at each router, thus allowing you to determine why a connection might be slow, for example. For a great overview of how the command works, use TRACERT to trace the route to a server in the UK (say, and then trace the route to a site in Mongolia, such as

Testing Network Connectivity with the PATHPING Command

A more advanced version of the PING command, PATHPING provides more detailed network troubleshooting information by not only sending requests to the destination host specified, but also all intermediate routers on the path to the destination. Ultimately, this allows the tool to calculate the degree of packet loss every step of the way to the destination, allowing you to determine where problems are occurring. For example, what might appear to be a problem with the site might actually be an issue with one of the routers or links on the way to this server.

Testing Network Connectivity with the PING Command

Perhaps no command line utility is more familiar to users than PING. On a TCP/IP network, the PING utility allows you to determine whether another system is reachable, while at the same time providing basic diagnostic information such as whether any packets are being lost en route. When troubleshooting a network connection, PING is almost always the first tool that any users will unleash to gather basic information. When issued with the –t command, PING will continuously send requests to a host until manually stopped with the CTRL+C command.

Querying DNS Servers with the NSLOOKUP Command

It’s not unusual to run into DNS problems when attempting to connect to Internet-based servers using names like If you find that your are experiencing problems connecting to resources by name, the NSLOOKUP command can be used to query DNS servers for answers. For example, without any switches, the NSLOOKUP command will display information about the DNS server your system is configured to use for lookups.

When followed by a domain name like, the tool will display information about the DNS servers that store information for that domain, as shown below. NSLOOKUP supports a wide variety of subcommands that make it a powerful troubleshooting tool, so be sure to look up the associated topic in Help and Support Center for a more detailed explanation.

Checking for Open Network Connections with the NETSTAT Command

Ever curious about the network connections that your XP systems has open to resources on your local network or the Internet? If so, the NETSTAT utility has the answers. This tool will display information about current connections to and from your system, including details of port numbers in use, the names or addresses or remote systems, and the state of the connection. This is a great tool to gather information if you suspect that outside users may be connected to your system, such as via a Trojan horse application.

Checking TCP/IP Network Settings with IPCONFIG

If you’re connected to a TCP/IP network, the IPCONFIG utility is one that you need to be familiar with. Most users are familiar with the tool from using it to renew an IP address allocated by a DHCP server via the /renew switch. However, IPCONFIG provides a wealth of useful information about your system’s TCP/IP settings, especially when the /all switch is issued. This command will display information about the state of your connection, whether DHCP is being used, the IP address, subnet mask, and default gateway configured on your system, and more.

Using Windows XP’s Command Line FTP Client

Windows XP ships with a great little piece of FTP client software. In cases where you’re using an XP system without a graphical FTP client installed, you can easily access FTP servers (and upload and download files) by using the command line FTP utility. For more information on how to use this tool, see the steps below.

Step 1: To connect to an FTP server using the command line FTP utility, type ftp followed by the name or IP address of the FTP server and press Enter. This will initiate a connection to the server.

Step 2: In order to access the server, provide your username and press Enter. If the server accepts anonymous connections, use “anonymous” as your username. Provide your password and press Enter. For anonymous connections, your password is any value (by convention, your email address.)

Step 3: To view a listing of the directories available on the FTP server, issue the dir command and press Enter. Some FTP servers run on UNIX or Linux and require native commands to be issued. If dir doesn’t work, try ls. Use the cd command to change directories if necessary.

Step 4: To download a file to your system, type get followed by the same of the file. Include quotes if the filename includes spaces. Before transferring a text file, issue the ascii command. Before transferring a binary file (such as an image) issue the bin command.

Step 5: To upload a file from your system, type put followed by the name of the file on your system, and the path to that file if it isn’t in the current directory. In this example the bin command is issued first, since the file being transferred is binary.

Step 6: To exit an FTP session and return to your command line, type bye and press Enter. This command ends your session completely. If you want to view a list of commands available during an FTP session, type ? and press Enter at the ftp> prompt.

Finding System MAC Addresses with the ARP Command

If your computer has an Ethernet or Wi-Fi network adapter card installed and is connected to a TCP/IP network, the Address Resolution Protocol is used to map IP addresses of systems you are communicating with on the local network to their network card’s physical MAC address. The ARP command allows you to view the MAC addresses of systems with which your system is communicating, such as your local router interface. This information can be useful when troubleshooting connection problems, or when a duplicate IP address is configured on your network.

To view the contents of the ARP cache on your system, issue the ARP –a command. If your ARP cache contains no entries, ping another computer on your network, and issue the command again.