Windows Tip Sheet

Command Line Performance

Some command-line tips from my TechMentor Conference session.

At the Las Vegas 2006 TechMentor conference, I ran a few sessions on command-line scripting. One of my slides showed a list of command-line tips and tricks. If you didn't make it to the conference, I thought I'd share a few of them with you.

Find out how long a system has been up Do this by checking the pagefile with the command:

DIR %systemdrive%\pagefile.sys /ah

If you've moved the pagefile to a different volume, then you'll need to modify the path. If the pagefile on a remote system is on C:\ you could run:

DIR \\servername\C$\pagefile.sys /ah

The page file time stamp should indicate when the server was last booted.

Create a text file from the command line To create a simple text file, perhaps with some computer names, at a command prompt type:

copy con servers.txt

and then press Enter. Carefully type in each name and press Enter. When finished, press Enter for a blank line and then Ctrl-Z. That's it!

Build a graphical report of your folder hierarchy At a command prompt type:

Tree C:\ /a >CDriveTree.txt

and wait a minute or so. When the prompt returns, you should have a text file that displays the entire folder structure laid out in a tree.

Use the SUBST command to assign a drive letter to a folder path I have a scripts directory I use frequently from a command prompt. Unfortunately it takes a lot of typing change to the directory. To make my life easier, I can use a command like:

SUBST S: "c:\documents and settings\jhicks\my documents\scripts"

which will add drive S: to my computer. Opening S: either in the command prompt or Windows explorer takes me right to my scripts directory.

I'll bring you more TechMentor tips in a future column.

About the Author

Jeffery Hicks is an IT veteran with over 25 years of experience, much of it spent as an IT infrastructure consultant specializing in Microsoft server technologies with an emphasis in automation and efficiency. He is a multi-year recipient of the Microsoft MVP Award in Windows PowerShell. He works today as an independent author, trainer and consultant. Jeff has written for numerous online sites and print publications, is a contributing editor at Petri.com, and a frequent speaker at technology conferences and user groups.

comments powered by Disqus

SharePoint Watch

Sign up for our newsletter.

I agree to this site's Privacy Policy.