Fog Creek Software
Discussion Board

Windows XP command line tools

Is there any master list of stuff you can do from the command line in Windows?

I just wasted about 2 days because I was trying to do stuff with AT.EXE, with all its attendant problems, not realizing that it was replaced by schtasks.exe, which is SO much better.

I've typed 'help' at the command prompt, and cmd /?, etc. but they are not that complete.

For one thing, right now I'm wondering if I can get the system info displayed in my computer properties, like the RAM and such from the command line.  I'm managing a whole bank of computers with XP.

Thanks for any help.

Tuesday, January 27, 2004

The "Command-line reference A-Z" in Windows help.

Been there done that with "AT" until to my suprise there were actually some useful things in help!

Bill Rushmore
Tuesday, January 27, 2004

I've been pretty happy with CyWin utilities.  Pretty much took care of those "Damn, if only I had grep/awk/etc.." moments.

Tuesday, January 27, 2004

I second the CygWin utilities.

but, here are a few things you might find handy to run from windows' command line to get you different bits of info (or to set them):

mem  - memory info, how much, available, etc.
set - without any params, gives current environment vars, which include most of the info that's on the systems' properties tab.
mode - without any params, gives details about all devices on the box.
hostname - gives you the box name, though you already get that from the COMPUTERNAME env var when you type 'set'.

for any, as you probably know, check them out in the help file already cited -- it really is pretty useful. Mostly the same info is available from the command line via '/?' as well.

Tuesday, January 27, 2004

I typed "mem" into the Win2K help (available via Start/Help) to find a description of the "mem" command: from that page, press "Related Topics" to get to the "Windows 2000 Command Reference Main Page".

Christopher Wells
Tuesday, January 27, 2004

Cygwin or SFU from Microsoft - now free, comes with cron.

Tuesday, January 27, 2004

Cygwin carries too much of a burden for my tastes - you can't just run the tools, you've got to drag in the entire environment. This bit me on the butt when I was using a Win32 ssh client which used the Cygwin stuff under the hood. Later I installed the full cygwin package, and my existing SSH client started crashing. Never got it working again.

For those addicted to unix tools, there's this project:

with win32 native ports of a large chunk of the GNU stuff.

The "win32" way to do what you want is probably to crank up the Windows Scripting Host. Learn a little JScript and the WMI objects and you can get any information you could ever want from the command line.

There's a neat tool call Scriptomatic available here:

to do a lot of this stuff for you. The Scripting section on MSDN is worth browsing in general.

Chris Tavares
Tuesday, January 27, 2004

Here are some of my favorites:

runas - This allows you to run a program as another user.  This is great when you're trying to help out a regular user with limited privileges and you need to use some administrative tool that they can't run.  Instead of wasting time logging them out and then logging in as administrator, just pop open a command window and use runas to launch the tool with the administrative account.

reg - This is great for all you scripters out there.  It's not part of the default Windows install and I don't recall off-hand which set of tools it belongs to other than that it is not a third-party tool.  It allows you to import or export registry keys from/to .reg files.

ipconfig - Used with the /all option, this will tell you all the important networking info for the PC such as IP address, MAC address, subnet mask, etc.  I find it's much faster to open a command window and type ipconfig /all than to navigate through the GUI to find out how the PC is configured.  The /renew and /release options are useful as well when you need to force a PC to get a new DHCP lease.

For the UNIX crowd, besides CygWin there's also Windows Services for UNIX which includes command line favorites such as grep.

Tuesday, January 27, 2004

>reg - This is great for all you scripters out there.  It's not >part of the default Windows install and I don't recall off->hand which set of tools it belongs to other than that it is >not a third-party tool.

I'm 98% sure that on Windows XP Professional, reg.exe is one of the many new command-line tools that are installed by default.

Mike Treit
Wednesday, January 28, 2004

Thanks for all the answers, they were great.  Don't know why the last place I think to look for help on Windows is the Windows help : )

Although I did search for "command line", and that reference didn't show up!  While when I searched for "command-line" (with hyphen), it worked.  Microsoft definitely needs some help with their search technology.

Since you've all been so helpful, can I throw out a stab in the dark -- does anyone see a problem with this usage of schtasks (not exact syntax):

schtasks /Create ONCE machineName userName password /ST 00:00:00 "TaskName"

schtasks /Run machineName "taskName"

Sorry I don't have the exact line (it's at work), but the idea is that I create a scheduled task for midnight, and then run it once _immediately_.  This WORKS, 99% of the time.  However for some reason every now and then it doesn't work.  Seems like a bug to me.

I'm guessing it is because I send the command to create it, and send the command to run it right away.

My current workaround plan is to either wait a few seconds between the 2 commands, or use schtasks /Query to see if the task is running -- and if not, retry it.  Just a random shot in the dark to see if anyone has come across this.

Wednesday, January 28, 2004

Sorry, one last note -- when it fails, it still displays the message "SUCCESS: attempted to run program on remote machine" or something, but it doesn't really run it.  I have checked the scheduled task log, and it says it ran it and returned 0, but it clearly did not.

I wonder under what conditions an "attempt" does not succeed.  If it fails, and I retry it a second later, it succeeds.

Wednesday, January 28, 2004

A while ago I was surprised to learn that Windows XP actually comes with a utility similar to grep, called findstr.

Wednesday, January 28, 2004

findstr has been there since Windows NT I believe.

John Topley (
Wednesday, January 28, 2004

Try hitting the function keys in a cmd window sometime. Can be interesting. F7 for example.

Then realise that cygwin/bash etc. is much better and install that instead.

Gordon Hartley
Wednesday, January 28, 2004

If you don't feal like figuring out the command line, there is a gui for adding scheduled tasks, called, strangely enough, scheduled tasks.  I believe it is under Accessories -> System Tools by default.

You'll also need to make sure you have the task scheduler service running.


Steve Barbour
Wednesday, January 28, 2004

Try using netsh in CMD prompt...


Abrar Kazi
Thursday, January 29, 2004

*  Recent Topics

*  Fog Creek Home