Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  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 log on before posting a comment.

If you don't have a username & password, please register now.




Top Viewed ArticlesView all articles
Friday at PASS Europe 2006

Kevin talks about the closing day of the event and shares a funny Microsoft film. ...

Escape From Yesterworld

Kevin points you to the funniest SQL Server website ever! ...

PsExec

This freeware utility lets you execute processes on a remote system and redirect output to the local system. ...


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?

Windows OSs Whitepapers Why SaaS is the Right Solution for Log Management

Related Events Introduction to Identity Lifecycle Manager "2"

Configuration Manager SP1 and R2 Overview

Power Up! With Virtualization Online Conference

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 Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


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 Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing