Resource Kit Quickies
With Compress and Freedisk, you can accomplish specialized tasks in NT.
August 12, 1999
Use Compress and Freedisk for specialized tasks
Several Microsoft Windows NT Server 4.0 Resource Kit tools are useful but don't require an entire column to describe. As a result, I've tended not to write about them, and that's a shame. This month, I make amends and write about a couple of short commands that I think you'll find helpful.
Compress
Many Microsoft products come packaged as a directory of files compressed with a Microsoft compression algorithm. You can recognize a compressed file by the final character in its file extension: an underscore (e.g., after compression, test.txt becomes test.tx_).
You'll occasionally want to replace files from the NT installation CD-ROM's i386 directory with new and improved files, and that's when the ability to perform your own file compression can come in handy. For example, suppose your hardware desperately needs driver xyz.sys, but the distribution version, xyz.sy_, is buggy. You do installs from a central, networked i386 directory, and you want to make future installs go smoothly. You get an improved xyz.sys file, and you want to ensure that future NT installs work from the improved driver rather than the original one. According to Microsoft documentation, all you need to do is simply copy the new xyz.sys file to the i386 directory (i.e., you don't need to compress the file). If NT Setup finds both an xyz.sys and an xyz.sy_, Setup will use the uncompressed version.
Unfortunately, that rule doesn't always work. Setup zeroes in on the compressed versions of some device drivers. To be safe, I use compress.exe to revise files before I put them into my distribution i386 directory:
compress –r xyz.sys
The -r option tells Compress to create xyz.sy_, the compressed version of xyz.sys. Compress creates the compressed file in the same directory as the uncompressed file. Alternatively, you can specify a directory for Compress to put the compressed files in and crunch up an entire directory:
compress –r *.* c:crunched
Freedisk
Occasionally, a problem with hard disk space crops up when I'm writing batch files that set up directories. For example, when I copy the i386 directory from a central distribution point to a local hard disk, sometimes the hard disk doesn't have enough free space. When I set up my NT seminars, I take a laptop with the NT source files and ask the client to provide a demonstration machine that I can install NT onto. One of the first things I do is copy the i386 directory from the laptop to the demonstration machine's local hard disk. Because NT's command interpreter integrates better with the network redirector than DOS's command interpreter did, copying a set of files from a share named i386 on a server named Source is simple. I just type
xcopy \sourcei386 c:i386 /s
The process doesn't require the mapping of drive letters.
Once in a while, the demo machine doesn't have enough free space on its hard disk. I don't always check for free space, but when I do, Freedisk helps out. Here's the syntax for Freedisk:
freedisk driveletter required_number_of_bytes
Freedisk returns OK if the drive has the requested number of bytes (not kilobytes or megabytes), or To small!! (the resource kit output proofreader slept through this one) otherwise. Freedisk also sets a return code of 0 to indicate sufficient space or 1 to indicate insufficient space. You can eliminate the unnecessary OK or To small!! notices with a redirection, as I've done in the following example:
@echo offfreedisk c: 300000000 >NUL:if errorlevel == 1 goto nogoodxcopy \sourcei386 c:i386 /sgoto quit:nogoodecho Not enough space to copy i386 files and do an NT installation:quit
About the Author
You May Also Like