For special file operations, most IT pros dig deep into their bag of computer knowledge, shell out to a Command Prompt window, and use the good old DOS-based XCopy command along with a very detailed set of parameters. Microsoft has never seen the need to give the XCopy command a GUI front end, so it often goes overlooked. That is, until now. I’ve recently created an HTML Application, the XCopy Tool, which you can download. It uses VBScript and the Windows Script Host to allow you to run the XCopy command from within the Windows user interface (see my caveats first). I’ll introduce you to the XCopy Tool and explain how it works.
The advantages of XCopy
The XCopy command is a viable file management tool. In fact, it’s such a versatile tool that Microsoft has included it in every operating system since MS-DOS 3. To keep pace with technology, the XCopy command has been beefed up with new parameters. For example, a new parameter in the Windows XP version of XCopy, the /G parameter, allows you to create decrypted destination files.
The XCopy command was expressly designed for performing bulk copy operations and can copy groups of files as well as entire directories—containing both files and subdirectories. Furthermore, the XCopy command is packed with a long list of parameters that will allow you to easily perform a wide range of elaborate file copy operations. For example, in addition to the elaborate file copy operation I mentioned above, the XCopy command can copy DACL and SACL information along with files, resume a failed network copy operation right where it left off, copy a folder tree but not the files, or exclude certain files from the operation.
For a full list of XCopy command’s features, type XCopy /? on the command line or see the Help system.
What is an HTML application?
When Microsoft introduced Internet Explorer 5.0, it incorporated some new features into the browser that essentially allow the browser to become a full-fledged Windows development platform. Using a combination of HTML, Windows Script Host, and VBScript or Jscript, you can build some pretty powerful HTML applications, or HTAs, without the need for a large-scale development platform. If you want to learn more about HTAs, check out Microsoft’s HTML Applications page on the MSDN site.
Taking a tour
Now that you have a pretty good idea of what an HTA is, let’s take a look at the XCopy Tool. To begin with, one of the nicest features of creating a tool as an HTA is that it requires fewer files than some of the other methods I’ve shown you in the past. The XCopy Tool requires just two files—the main HTA file and an .ICO file, which the HTA uses for the control menu and the taskbar.
After you download the XCopy Tool package, you can extract the files and copy them to any folder you want. Then, just double-click the XCopy Tool.hta file.
When you do, you’ll see the upper part of the main screen, as shown in Figure A.
The features provided via the HTA environment allow you to create a visually appealing interface that’s not only easier on the eyes, but looks more like a standard application than an Internet Explorer session. To keep all of the settings easily accessible, I designed the XCopy Tool in a single scrollable window. At the top are two buttons, which you’ll use to select the source and destination folders. Clicking either of these buttons will bring up a Browse For Folder dialog box, like the one shown in Figure B. This dialog box is made available by Internet Explorer itself and is accessed though the Windows Script Host.
|The Browse For Folder dialog box provides a nice way to choose your source and destination folders.|
In addition to giving you a nice interface for selecting your source and destination folders, the Browse For Folder dialog box lets you create new destination folders via the Make New Folder button.
Note on usage
As you select folders, keep in mind that you can’t choose any of the containers in the main tree. Doing so will result in an error message. While My Computer and My Network Place aren’t really logical choices for selection, My Documents is. However, due to the way that the script needs to access the full path to the folder in order to process that path for the actual XCopy command, a My Documents selection is not possible. Instead, you must drill down through My Computer\C:\Documents and Settings\Username to access and copy My Documents.
Once you’ve selected both the source and destination folders, you’ll see a confirmation dialog box, like the one shown in Figure C. If you click Yes, you’ll be ready to begin selecting options. However, if you click No, both the source and destination will be cleared out and you can start from scratch.
|Before you select any options, the XCopy Tool prompts you to confirm your choices for the source and destination folders.|
You can then choose from any of the 20 available XCopy command options. Once you scroll to the bottom of the window, you’ll see the OK and Cancel buttons. When you click OK, you’ll see a white-on-blue Command Prompt window appear, and XCopy will go to work quickly and efficiently transferring your files.
I chose not to include several other XCopy options because they’re not really applicable for modern operating systems.
Bonus benefit: Better system performance
The DOS-based XCopy command is still a fine little tool to have in your arsenal for bulk file copy operations. An added benefit is that since the Command Prompt runs in its own memory space, the XCopy operation works in the background, leaving the system much more responsive than if you were performing the copy operation from Windows Explorer. This is especially true when you’re copying a large number of files.