Skip navigation

Short Shell Script Supplies Diruse.exe Arguments


Diruse.exe is a handy command-line tool when you want to quickly see how much disk space a directory is using. To use it, you type the Diruse command, its options, and one or more directory names. I found myself frequently typing the command

Diruse /, . 

The /, option tells the Diruse command to use thousands separators when displaying directory sizes. The period (.) tells the Diruse command to get the current directory's size.

Because I was typing this command fairly frequently, I created a commandshell script that initializes the Diruse command with the /, option and the current directory as defaults. The script also expands the period to the full name of the current directory. That way, the full directory name appears in the Diruse.exe's output. This script even uses a shorter command name—du instead of diruse—to boot.

Listing 2 shows my DU.cmd script. The script's logic and flow should be fairly easy to follow. You can easily change the default options for the Diruse command. You just need to modify line that callout A in Listing 2 shows. For example, if you want to use both the /* and /, options, you'd use this line instead:

Set ARGS=/* /, 

To see what options are available, check out Diruse.exe's online help. For this script, I used Diruse.exe from the Windows XP Service Pack 2 Support Tools ( 49AE8576-9BB9-4126-9761-BA8011FABF38).

When you launch DU.cmd, you don't need to specify a directory name or even a period if you want the size of the current directory. Alternatively, you can specify multiple directory names on the command line. If any of the directory names contain spaces, enclose them in quotes. (DU.cmd handles the quotes automatically.)

—Bill Stewart
Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.