Windows IT Pro is the leading independent community for IT professionals deploying Microsoft Windows server and client applications and technologies.
  
  
  Advanced Search 


July 11, 2006

Short Shell Script Supplies Diruse.exe Arguments

RSS
Subscribe to Windows IT Pro | See More Tips Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

Download the Code Here

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 (http://www.microsoft.com/downloads/details.aspx?FamilyId= 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

End of Article



Reader Comments

You must be a registered user or online subscriber to comment on this article. Please log on before posting a comment. Are you a new visitor? Register now




Top Viewed ArticlesView all articles
Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

2009 Windows IT Pro Editors' Best and Community Choice Awards

Picking a favorite product from an impressive crowd of competitive offerings is never an easy task, and such was the case with our Editors' Best and Community Choice awards this year. ...

WinInfo Short Takes: Week of November 23, 2009

An often irreverent look at some of the week's other news, including some post-PDC some soul searching, a Google Chrome OS announcement and a Microsoft response, Windows 7 off to a supposedly strong start, the Jonas Brothers and Xbox 360, and so much more ...


Task Automation Whitepapers From Development to Production: Streamlining SharePoint Deployment with DocAve Deployment Manager

From Development to Production: Streamlining SharePoint Deployment with DocAve Deployment Manager

Related Events 7 Ways To Get More From Your SharePoint Deployment Now

Check out our list of Free Email Newsletters!

Task Automation eBooks Spam Fighting and Email Security for the 21st Century

A Guide to Windows Certification and Public Keys

Keeping Your Business Safe from Attack: Patch Management

Related Task Automation Resources Introducing Left-Brain.com, the online IT bookstore
Looking for books, CDs, toolkits, eBooks? Prime your mind at Left-Brain.com

Discover Windows IT Pro eLearning Series!
Clear & detailed technical information and helpful how-to's, all in our trademark no-nonsense format


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro DevProConnections IT Job Hound
Left-Brain.com Technology Resource Directory asp.netPRO ITTV Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 © 2009 Penton Media, Inc. Terms of Use | Privacy Statement