Windows training

YBET   Hardware IT training

4. DOS: commands systems

1. Date and hours - 2. Utilities hard drives and diskettes - 3. Backup and restore - 4. Utilities for partitions - 5. Attrib - 6. Other commands

The previous chapter analyzed file manipulation commands. This training will or even specific controls systems (computer configuration, check the hard disk). Found the controls Dates and times, check the hard disk, formatting and creating partitions.

1. Date and time

Two commands are used to change the date and time. It directly manages the system's BIOS. The XT lacked circuit RTC (Real Time Clock), the clock was not updated if the computer was not under voltage. This is no longer the case since the 286.

The use of these 2 commands in a DOS window is perfectly identical to the Setup on Windows by the control panel or in the BIOS directly.

1.1 TIME, internal command

c:\>TIME: displays and allows you to update the system time

By directly pressing enter, time is kept.

1.2. DATE, internal command

c:\>DATE: displays and allows you to update the system time

By directly pressing enter, the date is preserved. To update the date, enter the current date. The format differs from the language of the operating system. DOS is not Y2K compatible. A 1906 file date is equivalent to a file from 2006

2. Hard disk and floppy utilities.

2.1 CHKDSK, external command.

This command is created only from DOS 5.0. The options are changed in the current Windows DOS.

c:\>CHKDSK <Drive>: checks the specified disk

The report contains:

  • the amount of storage on the disk
  • the number of files and folders on the hard disk
  • remaining space
  • the number of sectors of the hard disk unusable
  • the size of the memory and space still available

The number of sectors (clusters) unusable results of the different entries of files on the disk, these sectors are included in the table of contents (FAT) in a way incorrect and recoverable by general rule programs. A sector may also be defective by failure on the hard disk and unusable. The command CHKDSK /F arranges clusters and retrieves the fragments of files (*.chk) text files. These files can be deleted. This command is executed (in graphic mode) by Windows 95 et next (FAT partitions) if the system has not been closed properly (power failure).

2.2 Format, external command

This command allows to format (prepare) the surface of a hard disk or a floppy disk.

c:\>FORMAT Drive: formats the disk <drive>

The information contained on the hard disk or floppy disk is lost, except in some cases with the Unformat command in DOS 6.0, 6.0, 6.2, and 6.22

c:\>FORMAT /S <drive> formats disk and inserts the system startup files

DOS up 6.22 version accepts only with a maximum size of 2 GB FAT partitions. The default keyboard is QUERTY, must be also use command into files config.sys and autoexec.bat with the appropriate command.

c:\>FORMAT /U <drive> format the disk and ensures better recovery when ordering Unformat (versions 5.0 to 6.22)
c:\>FORMAT /V: <label><disque>formats disk and gives as the name label.

The name of the volume can also be registered using the VOL command below. DOS does not accept accented characters or spaces.

c:\>FORMAT /F: <size> <disk name>; formats the disk using a defined format. By default, formatting uses the default format. <Size>can take the following values:
  • 360: disk single sided, single density 5 "1/4"
  • 720: disk single sided, double density 3 "1/2"
  • 1200: disk double sided, double density 5 "1/4"
  • 1440: disk double sided, double density 3 "1/2"
  • 2880: diskette 3 "1/2 2.88 MB
c:\>FORMAT /B :< diskette name > formats the disk and reserves the place to insert the system files later

2.3 Unformat, external command

This command is recognized only from DOS 5.0. A  format/U command allows better recovery. This works only if the floppy disk or the hard disk clusters have not been used by a new file since. It no longer exists in Windows.

c:\>UNFORMAT < disk name >: presents the old formatting, including files under certain conditions

2.4. Label, external command

c:\>LABEL <disk name>: gives a label (name) to the specified disk.

DOS does not recognize accented characters, or spaces. To display the name of the label, used the VOL command.

2.5 VOL, external command

c:\>VOL <disc>: displays the label of the disc created by the LABEL command

 

2.6. FDISK, external command

c:\>FDISK: allows to create, edit, or delete partitions on hard disks.

DOS only accepts 2 GB max FAT partitions. Higher versions accept partitions VFAT (still 2 GB) or FAT32 (Wn95B and above). This command is no longer used.  This order is taken again under DOS for the operating systems Wn95/98 and Millenium. In the case of XP, 2000 and NT, it is accessible only during the installation with a different interface. In practice, you can create partitions with Win98 and re-use them for other operating systems. It is preliminary to the FORMAT command and erases the data completely!

The partitions are software cuttings of the hard disks. The first accessible letter for a hard disk is C:, then D: and so on. The readers CD come then (except Win2000 and XP where one can modify the letters then).

As of starting, FDISK asks whether it must use readers of great capacity (FAT 32 - hard disks of more than 2 GB), the answer is YES

The following menu appears.

To create a partition under Win 95/98/Me

This order makes it possible to create partitions: by disc an obligatory principal partition and an optional wide partition (if one wants to cut the discs in segments). When a principal partition is created, FDISK proposes to use all space. If you choose YES, only one partition is created and activated automatically. There will be no wide partition. If you choose NOT, FDISK will propose a size for this principal partition to you and you will be able to create a secondary partition after.

When you create the secondary partition, FDISK automatically proposes to create a wide partition (one or more). You can choose the maximum size (the hard disk has a principal partition then C: and a secondary partition D:). If you do not use the entirety of the extended partition, you can create in this wide partition of other logical readers (E:, F:, ...)

Activate a primary partition.

This order makes it possible to use a primary partition as partition of starting (automatic if you create only one partition). In the case of Windows 95/98/millenium, it is obligatorily a principal partition.

If no partition is activated, the operating system, even installed, will not start starting from the hard disk.

To delete partition

This order makes it possible to remove partitions create. You must obligatorily start with the readers, then by partition DOS extended, then by the primary partition. But you are not obliged to erase all.

Hard drive selection.

This order appears only if several hard disks are connected in the PC. A small remark. If you use the order FORMAT under Win95/98/Millenium

2.7 Diskcopy, external command

c:\>DISKCOPY <source disk> < destination disk>: copies the contents of the source (including formatting) floppy disk to the destination disk.
c:\>DISKCOPY <source disk> <destination disk> /V: Additionally verifies the copied data.

This command is not for Hard disk. The diskcopy a: a: command is also accepted if you use only one floppy drive.

3. Backup and restore.

The 2 following commands to back up and restore files and directories on disks. They are most recognized by the current Windows. Significantly more efficient software are preferable. Starting with version 6.0, this command no longer exists, replaced by MS-Backup (Symantec purchased software license). It uses the archive bit.

3.1 backup, external control

c:\>BACKUP <path> < file name> < drive>/A/S/M/D: <date>: backup diskette (s) file (s) specified (s) in a single file (backup.001) and uses a control file (control.001). If the backup uses multiple disks, the second will take extension 002...
  • Path: path to the directory where the file to be backed up (omitted if it is in the current directory).
  • the name of the file to save. Wildcards are allowed. If it is not specified, all files in the folder are backed up.
  • drive: name of the disk or floppy where you want to save the files.
  • /A: adds the files backed up in the link to erase the floppy disk (for APPEND)
  • /S: also saves the files in subdirectories.
  • /M: only the files modified since the last backup
  • /D: <date> backs up files that have changed since the date following the last backup. The date takes the format jj/mm/aa for a French version.

The date of creation is that to the what the file was actually created, not that registration on the hard disk. If the file size is too large, DOS asks to insert a new and changes the extension of the file on the next disk.

Example 1: c:>backup a:/s backup all the files on the hard drive C: (including subfolders) to the floppy A

Example 2: backup c:\DOS A: /A /M backup all files in the DOS folder modified since the last backup.

Example.3: backup d:\*.exe b:/S /D:07/01/95 backup all files from the hard disk D: (including subdirectories) whose extension is EXE and whose creation date is greater than 07/01/95.

3.2 Restore: external command

This command (up DOS 5.0) to retrieve files saved with the BACKUP command. For superior versions, MS-backup enables the restoration.

c:\>RESTORE <lecteur> <disque> <chemin> <nom-fichier-a-restorer> /S /P /N /M
  • <lecteur>: disk containing the backup file
  • drive: files destination disk
  • <chemin>: destination directory
  • <nom-fichier>: files to recover from backup, all if omitted, wildcards accepted.
  • /S: also retrieves the directories
  • /P: requests permission to replace files with the modified date is later than the backup
  • /N: only files that do not exist in the destination folder
  • /M: only the files modified since the last backup.

4. Utilities partitions: conversion, cutting.

The majority of the technicians use specific software to modify partitions as the conversion of FAT (VFAT and FAT32) to NTFS or even cut a physical disk into several partitions. However, since Windows XP (it works also in Windows 7) commands are directly integrated into Windows... or rather DOS commands are listed under Windows.

4.1 CONVERT: converting partitions to NTFS (XP, VISTA, SEVEN)

The first use is actually the conversion of FAT (all versions combined) to NTFS partitions but other options are clearly more useful as the deletion on the set of a partition of a hard disk of the security settings. In Vista and Seven, start the command prompt in administrator mode via the pop-up button (the list of commands accessible with the right button of the mouse in the list of programs).

c:\>CONVERT <Volume>
  • <volume>: the letter of the disk to convert (example E :), the two points are required. The actual letter is displayed by "Computer" or "My computer"
  • /FS: NTFS: Specifies the conversion to NTFS (NTFS conversion to a version of FAT is not possible).
  • /V: verbose, all posts by conversions (names files and folders) will be displayed
  • /cvtarea:filename: (option deprecated, even if it allows in some cases to defragment the allocation table) allows to create a contiguous (non fragmented) file for additional data in the file table.
  • /NoSecurity: probably the most attractive option, allows it to convert all the folders and files to a partition so that they no longer security settings: owner, access rights,...
  • /X: force the dismantling of the partition. If the contents of a partition is opened (e.g. by simply displaying the content in a Windows window), this command will close the window, to start the conversion, but... folders and open files will not be processed, which is not recommended: close all (even reboot the PC before the command) before execution.

4.2 Diskpart: creating partitions.

DiskPart is not quite a command but well a utility in the direction where run it opened (still in DOS) a utility (use the EXIT command to exit). We will meet in the recovery console. For ordinary technicians, this command is a kind of partition-magic but for technicians, it allows considerably more opportunities, including repairs of damaged RAID 5 structures.

To start, in a command prompt window, just type diskpart (at this point, there are no options), again, the administrator mode is desirable from Vista.

5. Attrib

c:\>c :> ATTRIB [-/ + R] [-/ + S] [-/ + H] [-/ + A] /D /S [drive:] [path] file. The wildcards * and? are accepted in the name of the file.
  • +r: sets the read-only file attribute.
  • -r: removes the read-only file attribute.
  • +a: defines the attribute of file archive.
  • -a: removes the attribute from file archive.
  • +s: sets the system file attribute.
  • -s: removes the system file attribute.
  • +h: sets the hidden file attribute.
  • -h: removes the hidden file attribute.
  • /s: Applies attrib and its options to matching files in the current directory and all subdirectories.
  • /d: Applies attrib and its options to directories.

This command allows for example to view for editing the file hidden Boot.ini in the root of a Windows 2000, XP... (except Vista and later).

Usage example: attrib-r-s-h boot.ini

6. Other commands

6.1 VER command internal

c:\>VER displays the current DOS version

This command is used primarily by external software, for compatibility issues. It is known by all versions.

6.2 SYS, external command

c:\>sys [1 drive] [path 1] [drive 2] transfers files systems from drive 1 to the drive2

This command is used to make system a hard disk or a floppy disk. For example: sys a: c: transfers the system files (make bootable) the hard drive. The start A: floppy disk must be bootable. The version of the operating system transferred is the same as floppy disk.

6.3 MEM, external command

c:\>mem: displays the amount of memory present in the computer

This command works on all operating systems, including Windows XP or Seven, but does recognize that 1 GB max (the maximum size in DOS). It is more than useless.

NEXT > Autoexec.bat, config.sys: startup configuration

<- Hard and floppy disks on DOS

The hardware 1 course: computer and peripherals. The Hardware 2 course: networks, servers and communications

Mesure d'audience ROI frequentation par