Logo
PREGNANCY
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
 
 
Windows Server

Windows Server 2008 Server Core : Starting the Command Interpreter (part 4)

3/20/2012 5:38:20 PM

5. Using Common DOS Utilities

You'll find a number of common DOS utilities on your hard drive. Most of these utilities appear with every version of DOS, even those that Microsoft didn't produce (such as the IBM version). For the most part, these utilities perform maintenance tasks that you could perform in a batch file. For example, many people had batch files for working with the DiskCopy utility when floppy disks were popular. The following sections describe these utilities in detail.

5.1. Comparing the Contents of Disks with the Disk Comp Utility

You can use this utility to compare the contents of two floppy disks. Because of the way the utility works, the two floppies must have precisely the same format and you can't compare two newer forms of media, such as CDs. 

DISKCOMP [drive1: [drive2:]]

The following list describes each of the command line arguments.


drive1:

Specifies the source drive.


drive2:

Specifies the destination drive. If you don't specify a destination drive, the utility assumes that you'll use one drive for the comparison and prompts you to replace the source disk with the destination disk as needed.

5.1. Copying One Disk to Another with the Disk Copy Utility

You can use this utility to copy the contents of one floppy disk to another floppy disk. Because of the way the utility works, the two floppies must have precisely the same format. This utility uses the following syntax:

DISKCOPY [drive1: [drive2:]] [/V]

The following list describes each of the command line arguments.


drive1:

Specifies the source drive.


drive2:

Specifies the destination drive. If you don't specify a destination drive, the utility assumes that you'll use one drive for the comparison and prompts you to replace the source disk with the destination disk as needed.


/V

Verifies that the files copied correctly. Always use this option to ensure maximum copy reliability.

5.2. Modifying Data Files with the Edit Utility

The Edit utility is a very useful application to know about because it works when most other editors don't. The Edit utility is quite small, so you can place it on a floppy if you want or a CD that contains your diagnostic software. In addition, you don't need a graphical interface to use Edit, so it works at the DOS prompt, the Windows recovery console, or just about anywhere else you might need an editor. However, even with these limits, Edit supports a robust interface for a text editor, as shown in Figure 1. From a Server Core perspective, however, the Edit utility is best because it has no reliance on Windows functionality, so you don't need to worry about issues such as common dialog box usage.

Figure 1. Use Edit wherever you need a fully functional text editor.

As you can see, the utility sports many of the same features as Notepad, but without the Note-pad requirements. This utility uses the following syntax:

EDIT [/B] [/H] [/R] [/S] [/<nnn>] [/?] [file(s)]

The following list describes each of the command line arguments.


/B

Sets Edit to start in monochrome mode.


/H

Sets Edit to start with the maximum number of lines of text for your hardware. The default setup displays 25 lines of text.


/R

Loads files in read-only mode. Use this option when you want to view the file content without accidentally changing it.


/S

Forces Edit to use short filenames.


/nnn

Loads a binary file and displays the content by wrapping any long lines to the specified number of characters.


file

Specifies the name of the file to load. You can use wildcard characters and multiple file specifications to load multiple files. This argument must appear as the last argument on the command line.

5.3. Formatting a Disk with the Format Utility

The Format utility formats a drive and prepares it for use. The utility removes any existing data from the volume you select. This section discusses the command line version of the Format utility.

The recovery console offers a slightly different version of this utility. You must be a member of the Administrators group to use this utility. The utility always displays a warning message before it formats a hard drive; you must specifically accept the warning message content before the format will start. This utility uses the following syntax:

FORMAT volume [/FS:file-system] [/V:label] [/Q] [/A:size] [/C] [/X]
   [/P:Passes]
FORMAT volume [/V:label] [/Q] [/F:size] [/P:Passes]
FORMAT volume [/V:label] [/Q] [/T:tracks /N:sectors] [/P:Passes]
FORMAT volume [/V:label] [/Q] [/P:Passes]
FORMAT volume [/Q]

The following list describes each of the command line arguments.

The Format utility has caused people more woe than any other utility ever created. Simply stated, the Format utility will format your hard drive. In many cases, you can recover files that the Format utility removes from the hard drive using a special utility, but the process is time consuming and error prone at best. Use this utility with extreme caution.



volume

Specifies the drive letter, mount point, or volume name to format. Always include this argument because the default value is the current drive.


/FS:
filesystem

Specifies the file system to use to format the volume. You have the option of using the FAT (older 16-bit), FAT32, or NTFS file systems when working with a hard drive. Floppy media only accepts the FAT file system.


/V:
[ label]

Specifies the volume name. If you use this command line switch without specifying a volume name, the Format utility prompts you for a volume name on completion of the format.


/Q

Performs a quick format of the media. A quick format deletes the file table and the root directory of the media. It doesn't perform a sector-by-sector scan of the media to locate bad sectors. You should only use this option with known good media.


/C

Creates an NTFS volume that the system compresses by default. Consequently, you won't need to perform this step separately later.


/X

Forces the system to dismount the drive before formatting if necessary. Dismounting the drive closes all open handles.


/A:
size

Overrides the default allocation unit size for the hard drive. You can use this feature to optimize storage for specific tasks. For example, if you plan to store many small files, you might want to use a small allocation size. The size argument can include 512 bytes, 1,024 bytes, 2,048 bytes, 4,096 bytes, 8,192 bytes, 16 KB, 32 KB, and 64 KB cluster sizes for NTFS drives. You can't use compression on NTFS drives with a cluster size larger than 4,096. A FAT- or FAT32-formatted drive can use cluster sizes of 512 bytes, 1,024 bytes, 2,048 bytes, 4,096 bytes, 8,192 bytes, 16 KB, 32 KB, 64 KB, 128 KB, and 256 KB. You can only use the 128 KB and 256 KB options for a sector size greater than 512 bytes.

NOTE

FAT and FAT32 file systems impose a limit on the number of clusters per volume. A FAT-formatted drive can have 65,526 or fewer clusters. A FAT32-formatted drive can have any number of clusters between 65,526 and 4,177,918. The Format utility stops immediately when it detects that a drive can't meet the number of cluster requirements using the specified cluster size.


/F:
size

Specifies the size of the floppy disk to format. The default setting is 1.44 MB. You can specify this value as 1,440, 1,440k, 1,440kb, 1.44, 1.44m, or 1.44mb. The Format utility will also format 720 KB floppies. None of the Microsoft documentation specifies whether the utility formats 2.88 MB floppies. Theoretically, you can also format the very old 51/4-inch floppies with sizes of 640 KB and 1.2 MB. Use this option, whenever possible, instead of the /T and /N command line switches.


/T:
tracks

Specifies the number of tracks per side of the disk.


/N:
sectors

Specifies the number of sectors per track.

The format command provides a number of exit codes that you can use when working with batch files. The following list describes each of the exit codes.


0

The format completed successfully.


1

The format failed because you provided incorrect arguments.


4

A fatal error occurred. For example, the utility couldn't format the drive because the system has it locked for use. The Format utility uses this error when the 0, 1, or 5 codes don't apply.


5

The user pressed N when the utility asked whether it should proceed with the disk format. Pressing N always stops the formatting process.


/P:
Passes

Zeroes every sector on the hard drive the number of times defined by Passes. The /P command line switch makes it possible for you to erase the data on a hard drive more completely. However, the only certain way to ensure the data is gone is to destroy the hard drive completely and magnetically erase the media.

5.4. Loading Older DOS Applications with the Load Fix Utility

Some older applications don't load correctly. You'll see a "Packed file corrupt" error message when you try to load them. The LoadFix utility modifies the loading process for these applications so they load above the 64 KB area of memory used for operating system needs. This utility uses the following syntax:

LOADFIX [drive:][path]filename

The following describes the command line argument:

[drive:][path]filename Specifies the name and location of the file to modify.

5.5. Terminating a Session Using the Logoff Utility

The Logoff utility ends a user session and logs off the user. The advantage of this utility is that you can find it in older versions of Windows, so you can use the same script on just about any machine. The disadvantage of this utility is that it provides limited functionality. This utility uses the following syntax:

LOGOFF [sessionname | sessionid] [/SERVER:servername] [/V]

The following list describes each of the command line arguments.


sessionname

Defines the name of the session that you want to log off. Older versions of the tool don't provide this argument. The default is to log off the current session.


sessionid

Defines the identifier of the session that you want to log off.


/SERVER:
servername

Specifies the server containing the user session to log off. Some documentation implies that you need Terminal Server to use this command line switch, but it appears to work just as well without it.


/V

Displays detailed information about the actions the system performs during the logoff cycle.

Other -----------------
- Windows Server 2008 Server Core : Starting the Command Interpreter (part 3) - Modifying AutoExec.NT & Defining Application Compatibility with the SetVer Utility
- Windows Server 2008 Server Core : Essential Registry Hacks - Modifying the Software Setup
- Sharepoint 2007 : Customizing a SharePoint Site - Create a Content Type
- Sharepoint 2007 : Modify the Top or Left Navigation Bar & Create a Site Column
- Microsoft Systems Management Server 2003 : Configuring Site Server Properties and Site Systems - Monitoring Status and Flow
- Microsoft Systems Management Server 2003 : Configuring Site Server Properties and Site Systems - The Site Configuration Process Flow
- Windows Server 2003 : Windows Security and Patch Management - Using Auditing and the Event Log
- Windows Server 2003 : Windows Security and Patch Management - Locking Down Windows
- Recovering from a Disaster in an Exchange Server 2007 Environment : Recovering from a Site Failure & Recovering from a Disk Failure
- Recovering from a Disaster in an Exchange Server 2007 Environment : Identifying the Extent of the Problem & Preparing for a More Easily Recoverable Environment
- Windows Server 2008 Server Core : Setting the Environment & Modifying the Hardware Setup
- Windows Server 2008 Server Core : Performing Console Configuration
- Windows Server 2008 : Using Basic ds Commands - Understanding Distinguished Names & Adding Objects with dsadd
- Windows Server 2008 : Manipulating IIS with appcmd
- Microsoft Lync Server 2010 Edge : Edge Server Administration (part 2)
- Microsoft Lync Server 2010 Edge : Edge Server Administration (part 1)
- Sharepoint 2010 : Setting Up the Crawler - Crawling Other Document Types with iFilters
- Sharepoint 2010 : Setting Up the Crawler - Defining Scopes
- Microsoft Dynamics CRM 4.0 Accelerators : Extended Sales Forecasting Accelerator (part 1) - CRM Reports
- Microsoft Dynamics CRM 4.0 Accelerators : Extended Sales Forecasting Accelerator (part 1) - CRM Customizations
 
 
Most view of day
- Windows Server 2012 : Enabling and disabling the graphical interface in Hyper-V
- Microsoft Project 2010 : Defining Project Resources - Defining Resource Costs
- Microsoft Project 2010 : Fine-Tuning Task Details (part 10) - Scheduling Summary Tasks Manually
- Sharepoint 2013 : Integrating Apps for Office with SharePoint (part 1) - Standalone Apps for Office
- Microsoft SharePoint 2013 : Working with Visio Services - Designing dashboards - Data linking (part 2) - Refreshing external data
- Sharepoint 2013 : Managing Security - See What Permissions Are Set (part 1) - Check Permissions on Files and List Items
- Sharepoint 2013 : Backup and Restore (part 2) - Export and Import - Using PowerShell, STSADM, Central Administration
- BizTalk 2006 : Getting Started with Pipeline Development (part 3) - Configuring Recoverable Interchanges, Using the Default Pipelines
- Extending Dynamics AX 2009 (part 1)
- Microsoft Excel 2010 : Using Formulas - Table References in Formulas, Using Array Formulas
Top 10
- Sharepoint 2013 : Working with the CSOM (part 6) - Working with the JavaScript client object model - Creating, reading, updating, and deleting in the JavaScript client object model
- Sharepoint 2013 : Working with the CSOM (part 5) - Working with the JavaScript client object model - Handling errors
- Sharepoint 2013 : Working with the CSOM (part 4) - Working with the JavaScript client object model - Returning collections
- Sharepoint 2013 : Working with the CSOM (part 3) - Working with the managed client object model - Creating, reading, updating, and deleting
- Sharepoint 2013 : Working with the CSOM (part 2) - Working with the managed client object model - Handling errors
- Sharepoint 2013 : Working with the CSOM (part 1) - Understanding client object model fundamentals
- Windows Phone 8 : Configuring Mailbox Settings (part 5) - Configuring Automatic Replies
- Windows Phone 8 : Configuring Mailbox Settings (part 4) - Lightening the Display,Changing the Mailbox Sync Settings
- Windows Phone 8 : Configuring Mailbox Settings (part 3) - Message Signatures, Blind CCing Yourself
- Windows Phone 8 : Configuring Mailbox Settings (part 2) - Unlinking Mailboxes, Conversation View
 
 
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
2015 Camaro