Subscribe to Windows IT Pro

 

Get Newsletters

  • Get the Latest News
  • Product Updates
  • Helpful Tricks
  • Productivity Tips

Subscribe Now!

April 28, 2008 12:00 AM

Vista Command-Line Tools

Use these tools to mirror directories, manage ACLs, perform backups, and complete other important administrative functions
Windows IT Pro
InstantDoc ID #98458
Rating: (6)
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

Related Content:

ARTICLE TOOLS

Comments
  • Duncan
    4 years ago
    Oct 21, 2008

    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.

  • PETER
    4 years ago
    Oct 17, 2008

    Robocopy was first included with the OS in Windows XP.

  • Julius
    4 years ago
    Oct 17, 2008

    The info provided to us admins is awsome here.

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

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

  • Julius
    4 years ago
    Oct 17, 2008

    The info provided to us admins is awsome here.

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

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

  • Curtis
    4 years ago
    Oct 17, 2008

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

You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

White Papers

Get your Windows 7 deployment off to the right start by implementing PC lockdown. A locked-down environment is easier and cheaper to support since users are less likely to make unnecessary changes to the core system configuration - read more here!

Essential Guides

Is your iSCSI "lossy"? The reality is that most off-the-shelf Ethernet hardware deployed for iSCSI can lose packets, resulting in slow performance or application downtime. Learn how to assess your current iSCSI infrastructure and engineer an advanced iSCSI SAN infrastructure.

Web Seminars

What's the best way to keep your network safe from malware? In this web seminar, security expert Greg Shields suggests an alternative method to the traditional blacklisting approach that is common with anti-virus and anti-malware solutions.

eLearning Series

We bring the experts direct to you to share their real-world perspective and expertise. During each event, three sessions stream in real time, so you can learn, ask questions, and get solutions.
Upcoming event: Getting the Most with Exchange 2010 with Paul Robichaux

Subscribe to Windows IT Pro!

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.