Windows command line references

I found that TechNet has references for the Windows command line utilities.  Much of these are just a rehash of the help you’d get with /? but at least they’re easier to read… This is a list of commands for Windows Server 2003 (most apply to Windows XP as well), and here is the list for…


On blogging tools

One of the obstacles to frequent posting (at least mine) is that the types of posts I typically make include code.  Code that I would like to be formatted nicely.  Unfortunately, this previously meant hand-crafting HTML to make it all look nice.  In some cases, I could write up scripts in Visual Studio and paste…

1

Definitive list of illegal filenames?

Earlier, I tried to come up with a definitive list of illegal filesystem names, but it seems this is already documented.  Who knew? http://support.microsoft.com/Default.aspx?id=74496


More on command line redirection

For those of you who are more interested in the gritty details of command line redirection, RaymondC has posted a couple of great articles recently on his excellent The Old New Thing blog.  The first discusses how (and more importantly, why) the redirection symbols are parsed by CMD.EXE rather than the program you’re calling.  The second points…


Evolution of a solution

The other day, someone posted a message at work asking for a way to find out the drive letter for partition 1 on the first disk. The first response offered this: C:>echo list volume | diskpart Microsoft DiskPart version 5.1.3565 Copyright (C) 1999-2003 Microsoft Corporation. On computer: SINISTAR DISKPART>   Volume ###  Ltr  Label        Fs     Type        Size     Status     Info   ———-  —  ———–  —–  ———-  ——-  ———  ——–   Volume 0     F                       DVD-ROM         0 B   Volume…

2

Making your scripts look prettier

Many languages provide a mechanism to make their code look pretty. VBScript, for example, assumes one statement per line, but including an underscore at the end of the line indicates that your statement continues on the next line.NormalWScript.Echo “This is line one” & vbcrlf & “This is line two” & vbcrlf & “This is line three”With…


That’s a pretty shifty argument…

It’s pretty easy to deal with up to 9 arguments in batch through built-in variables %1 through %9.  For example:     echoargs.cmd    @echo off    echo %1    echo %2    echo %3    echo %4    echo %5    echo %6    echo %7    echo %8    echo %9 If you feed this A B C D E F G H I,…

1

Ignoring the output of a command

Earlier, I used >nul 2>&1 to suppress the output of a command, and the question was brought up as to why this was “better” than just >nul. To understand what’s going on, you need to know that there are two streams of output from any given command.  There’s STDOUT (or “standard out”, or “standard output”)…

2

Opening web pages from the command line

I spend a lot of time in a CMD window.  I mean a lot of time.  Often I’d like to open a web page, but opening up Internet Explorer and navigating my way to the page in question is such a chore.  I’m lazy.  I don’t like mouse-clicks.  Enter the quicky batch file.     traffic.cmd…


Backslashes vs. slashes – who knew?

Here’s something I’d never noticed until today, when I discovered it quite by accident.  In general, to run a program in a different directory, you specify the path with backslashes, such as C:\WINDOWS\system32\notepad.exe.  This should be no surprise.  What is surprising, though, is that if you use call to run this, you can use forward…

3