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


April 28, 2008

Vista Command-Line Tools

Use these tools to mirror directories, manage ACLs, perform backups, and complete other important administrative functions
RSS
Subscribe to Windows IT Pro | See More Administration Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

Executive Summary:
Microsoft's Windows Vista operating system (OS) includes a host of command-line tools to help you administer your systems. Here are the commands you need to modify your boot configuration, manage access control lists (ACLs), perform backups and system assessments, and other useful functions.

The lion’s share of the attention to Windows Vista always seems to center around the new interface, which is understandable considering its exciting new look and feel. Unfortunately, part of the attention is because you now have to find new ways of doing old tasks. However, new features in Vista don’t end with the UI. Under the covers, Vista also sports command-line tools—many of them new—that make a powerful addition to your administrative toolbox. Here are my favorites.

10. Bcdedit—The days of editing the simple boot.ini file are gone. Vista’s new boot process saves its system boot configuration in the Boot Configuration Data (BCD) store. Like all bad ideas, the BCD store replaces a simple concept with a complex albeit more secure one. Bcdedit is your primary tool for editing the BCD store. Bcdedit supports a wide set of command-line options. For instance, to list the contents of the store you can run

bcdedit /enum

9. Choice—A handy batch-file command, choice lets you display a list of choices to users of a command-shell script. The choice command returns an index value in the ERRORLEVEL environment variable indicating the user’s selection. For example, the following command prompts users to enter Y, N, or C; the ERRORLEVEL variable returns 1, 2, or 3 respectively:

CHOICE /C YNC /M “Press Y, N, or C.”

8. Waitfor—The waitfor command is a useful scripting command that synchronizes processes running on multiple systems on the network. As its name suggests, waitfor can pause a script until the command processor receives a specified signal, and it can also send a signal to one or more systems on the network. The following command waits for the ScriptDone signal:

waitfor ScriptDone

7. Wbadmin—Although you might not have a clue based on its name, the new wbadmin command is Vista’s command-line backup tool. The following example shows how to use wbadmin to backup the C and D drives to the share named backup on myserver:

wbadmin start backup -backupTarget:\\myserver  backup include:c:,d:

6. Icacls—The Icacls command replaces the older cacls command. Icacls lets you list, update, and back up the access control lists (ACLs) for files and directories. The following example shows how you can save the ACLs for the C:\temp directory:

icacls c:\temp /save tempacl

5. Winsat—Winsat is the new Windows System Assessment tool. It runs automatically when you install Vista, but you can run it on demand for simple system benchmarking and system information. For instance, to list your system information, you could run winsat with the features parameter:

winsat features

4. Clip—The new clip command is a handy tool that copies the output of other command-line tools to the clipboard. The following example shows how to use clip to copy the contents of the file mytext.txt to the clipboard:

clip < mytext.txt.

3. Forfiles—The forfiles command is another useful batch-file tool. It executes a command over a set of files. Forfiles is much easier to use than the older and more obtuse for command. The following example shows how you could list all files more than 30 days old in the c:\temp directory:

forfiles /p c:\temp /s /d -30 /c “cmd /c echo @file

2. WinRS—The WinRS tool is essentially the Windows version of Linux’s Secure Shell (SSH). WinRS lets you open a secure command window to a remote host. All the contents of the remote shell are encrypted. The following example connects to the server named myserver and runs the dir command:

winrs -r:myserver dir

1. Robocopy—Without a doubt, the best commandline addition to Vista is robocopy. Although robocopy isn’t new to most of our readers (it’s been a staple in the Windows Resource Kit for years), Vista is the first release that includes robocopy as a part of the OS. Robocopy is a super-powerful command-line copy tool. The following example shows how to create a mirrored copy of the directory called shares and all of its subfolders.

robocopy “C:\Shares” “\\server2\ Shares Backup” /MIR /R:2 /NP

End of Article



Reader Comments
One of my favorites is vssadmin to manage the system restore space.

Sitruc October 17, 2008 (Article Rating: )


The info provided to us admins is awsome here.

We get answers to possibly all our questions at this site.

KUDOS TO YOU!!!!!!!!!

killercommando October 17, 2008 (Article Rating: )


The info provided to us admins is awsome here.

We get answers to possibly all our questions at this site.

KUDOS TO YOU!!!!!!!!!

killercommando October 17, 2008 (Article Rating: )


Robocopy was first included with the OS in Windows XP.

PeterBoyles October 17, 2008 (Article Rating: )


Choice was actually included with MS DOS 6. I believe it has surfaced again in at least one resource kit but its good to have it back in the base product at last.

duncan_priest October 21, 2008 (Article Rating: )


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
WinInfo Short Takes: Week of November 9, 2009

An often irreverent look at some of the week's other news, including some more Windows 7 sales momentum, some Sophos stupidity, Microsoft's cloud computing self-loathing, more whining from the browser makers, Zoho's "Fake Office," and much, much more ...

Command Prompt Tricks

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

Windows 7 Sets Sales Record

Microsoft CEO Steve Ballmer described Windows 7's first ten days of sales as "fantastic" while in Japan yesterday. ...


Related Articles Q. How can I view the OSs listed in the boot configuration data store?

Castaway on Command-Prompt Island

How can I remotely run commands on a Windows Vista or Windows Server 2008 box?

Icacls: The New and Improved Cacls?

Related Events WinConnections and Microsoft® Exchange Connections

Check out our list of Free Email Newsletters!

Windows OSs eBooks Understanding and Leveraging Code Signing Technologies

A Guide to Windows Certification and Public Keys

SQL Server Administration for Oracle DBAs

Related Windows OSs 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