Windows XP shutdown dialog box.
Image via Wikipedia

In the bad old days, when I wanted to shut down a remote Windows machine, I would log on through terminal services and then hit the ‘Turn Off’ button.

This carried the overhead of logging onto the computer manually, waiting for the settings to load and then clicking on the start men, etc, etc, etc.

Now we can just fire up cmd.exe and enter the following command:

shutdown -r -t 1 -m \\[computername]

In this instance we are specitying a restart of a remote machine, hence the -r and -m flags respectively.

For info, the spec for the command is below:

Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx]
                [-c "comment"] [-d up:xx:yy]
No args             Display this message (same as -?)
-i                  Display GUI interface, must be the first option
-l                  Log off (cannot be used with -m option)
-s                  Shutdown the computer
-r                  Shutdown and restart the computer
-a                  Abort a system shutdown
-m \\computername   Remote computer to shutdown/restart/abort
-t xx               Set timeout for shutdown to xx seconds
-c "comment"        Shutdown comment (maximum of 127 characters)
-f                  Forces running applications to close without warning
-d [u][p]:xx:yy     The reason code for the shutdown
                    u is the user code
                    p is a planned shutdown code
                    xx is the major reason code (positive integer less than 256)
                    yy is the minor reason code (positive integer less than 65536)

You could, of course type in shutdown /?

, , ,

Yesterday when wanting to run some commands from the Windows Command Shell, I fired it up on my windows XP desktop, only to find things were a little strange.

For a start it was slower – pasting something in from the clipboard seemed to take time. And then it didn’t protest too much when I started typing things I felt sure shouldn’t work. Then things I wanted to happen didn’t happen when I expected them to.

It all left me a bit confused.

And then I noticed, I’d typed in “command.exe” not “cmd.exe”. I rectified the mistake, and everything seemed to be just fine. But I did wonder what the difference was.

Cmd or Command?

Well, initially, from the above screenshot we can see that the version information has the text is ‘Windows DOS’ vs ‘Windows XP’. However there are a number of other differences:

Cmd.exe is a command-line interface, provided so you can run command-line commands. It is not a DOS window.

Command.com is a stripped-down version of the command processor from DOS. It is a 16-bit application which is used for older DOS compatibility and actually runs inside the NTVDM (NT Virtual DOS Machine) due to its 16-bit nature.

With Command.com we do not have the long name support. Typing in ‘cd program files‘ yields the error ‘Too many parameters – files‘, whereas this command works fine in Cmd.exe. In fact to get this to work in Command.com, we have to type ‘cd progra~1‘.

,