1.13k likes | 1.24k Views
7. Using ASSOC , FTYPE , ATTRIB , SUBST , XCOPY , EDIT , and DOSKEY. ASSOC and FTYPE. Each file extension is associated with a specific filetype . Use ASSOC command to view and modify the link between extension and type.
E N D
7 Using ASSOC, FTYPE, ATTRIB, SUBST, XCOPY, EDIT, and DOSKEY Gary DeRoest
ASSOC and FTYPE Each file extension is associated with a specific filetype. Use ASSOC command to view and modify the link between extension and type. Each filetype is associated with an executable program located on a filesystem. Use FTYPE to view and modify the lick between filetype and program. Gary DeRoest
ASSOC Help Page Displays or modifies file extension associations ASSOC [.ext[=[fileType]]] .ext Specifies the file extension to associate the file type with fileType Specifies the file type to associate with the file extension Type ASSOC without parameters to display the current file associations. If ASSOC is invoked with just a file extension, it displays the current file association for that file extension. Specify nothing for the file type and the command will delete the association for the file extension. Gary DeRoest
ASSOC Display all current extension-filetype associations C:\> ASSOC .jpg=jpegfile .mpeg=mpegfile .txt=txtfile .zip=CompressedFolder … Gary DeRoest
ASSOC Display specific extension-filetype association C:\> ASSOC .doc .doc=Word.Document.8 Gary DeRoest
ASSOC Create new extension-filetype association C:\> ASSOC .txt=Word.Document.8 Gary DeRoest
FTYPE Help Page – Part 1 Displays or modifies file types used in file extension associations FTYPE [fileType[=[openCommandString]]] fileType Specifies the file type to examine or change openCommandString Specifies the open command to use when launching files of this type. Type FTYPE without parameters to display the current file types that have open command strings defined. FTYPE is invoked with just a file type, it displays the current open command string for that file type. Specify nothing for the open command string and the FTYPE command will delete the open command string for the file type. Gary DeRoest
FTYPE Help Page – Part 2 Within an open command string %0 or %1 are substituted with the file name being launched through the assocation. %* gets all the parameters and %2 gets the 1st parameter, %3 the second, etc. %~n gets all the remaining parameters starting with the nth parameter, where n may be between 2 and 9, inclusive. For example: ASSOC .pl=PerlScript FTYPE PerlScript=perl.exe %1 %* would allow you to invoke a Perl script as follows: script.pl 1 2 3 If you want to eliminate the need to type the extensions, then do the following: set PATHEXT=.pl;%PATHEXT% and the script could be invoked as follows: script 1 2 3 Gary DeRoest
FTYPE Display all filetype-application associations C:\> FTYPE txtfile=%SystemRoot%\system32\NOTEPAD.EXE %1 Word.Document.8="C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE" /n /dde jpegfile=rundll32.exe C:\WINDOWS\System32\shimgvw.dll,ImageView_Fullscreen %1 … Gary DeRoest
FTYPE Display specific extension-filetype association C:\> FTYPE Word.Document.8 Gary DeRoest
FTYPE Create new filetype-application association C:\> FTYPE txtfile=C:\programs\textpad.exe Gary DeRoest
ATTRIB Set and display DOS file attributes • R - Read-Only • A - Archive • S - System • H - Hidden • /S • /D • + set • - clear Gary DeRoest
ATTRIB Set an attribute for file in current drive:directory Make the file read-only A:\> ATTRIB +R myfile.txt Setting multiple attributes A:\>ATTRIB +H +S myfile.txt Setting attributes for specified files in current d:d A:\>ATTRIB +A *.txt Gary DeRoest
ATTRIB Set an attribute for file in different drive:directory Make the file read-only A:\> ATTRIB +R C:\DATA\myfile.txt Setting multiple attributes A:\>ATTRIB +H +S DATA\myfile.txt Setting attributes for specified files in current d:d A:\DATA\>ATTRIB +A \*.txt Gary DeRoest
ATTRIB Clear an attribute for file Clear the read-only attribute A:\> ATTRIB -R C:\DATA\myfile.txt Clearing multiple attributes A:\>ATTRIB -H -S DATA\myfile.txt Clearing attributes for specified files A:\DATA\>ATTRIB -A \*.txt Gary DeRoest
ATTRIB • A:\> ATTRIB DATA.TXT • A:\> ATTRIB C:\WUGXP\*.99 • A:\> ATTRIB +R DATA.TXT • A:\> ATTRIB -H C:\IO.SYS • A:\> ATTRIB -S -H -R *.* /S NOTE: DIR /V Gary DeRoest
Folder Options Gary DeRoest
Folder Options Gary DeRoest
Attributes Gary DeRoest
Other File Systems’ Attributes • Rename inhibit • Modify • Compress • Purge immediately • Copy inhibit • Execute • Encrypt Gary DeRoest
SUBST • Substitute a drive letter for a path name • SUBST [drive1: [drive2:] path] • SUBST drive1: /D • SUBST Gary DeRoest
SUBST • Be cautious when using SUBST command with network drives • Never use SUBST drive letters with commands such as LABEL, FORMAT, DISKCOPY, FDISK, RECOVER, DISKCOM, CHKDSK • SUBST A: B:\ Gary DeRoest
XCOPY • Copy files, directories like COPY with many more options • /D:date - copy files modified on or after date • /S - copies directories except empty ones • /E - copies directories including empty ones • /H - copy system and hidden files also • /T - create directory structure but not copy files • /K - copy attributes • /Y - overwrites existing files without prompting Gary DeRoest
XCOPY • XCOPY C:\*.99 A:\*.DTA • XCOPY C:\TEMP\*.* • XCOPY C:\???.* A:\DATA • XCOPY C:\???.* A:\DATA /S /E • XCOPY C:\* A:\DATA /D:05-01-98 /S NOTE: /S /H /R /E /K Gary DeRoest
EDIT • EDIT • EDIT A:\STATES.CAP • EDIT C:WUGXP\SPORTS\FOOT-PRO.TMS Gary DeRoest
EDIT Gary DeRoest
EDIT Gary DeRoest
EDIT Gary DeRoest
EDIT Gary DeRoest
EDIT Gary DeRoest
EDIT Gary DeRoest
EDIT Gary DeRoest
EDIT Gary DeRoest
DOSKEY • TSR • Command history and editing tool • F7 - display • F8 - Search • F9 - Select Gary DeRoest
DOSKEY • DOSKEY /macros • DOSKEY C=CLS • DOSKEY RM=DEL • DOSKEY /history • DOSKEY /macrofile=<filename> Gary DeRoest
8 Organizing and Managing your Hard Disk Gary DeRoest
Typical Hard-Disk Configuration Gary DeRoest
Disk Organized by Application Gary DeRoest
Disk Organized by Project Gary DeRoest
XCOPY & MOVE • 2 important tools to organize disks • ATTRIB also helps in marking files to be copied and/or moved Gary DeRoest
TREE A:\>tree /? Graphically displays the folder structure of a drive or path. TREE [drive:][path] [/F] [/A] /F Display the names of the files in each folder. /A Use ASCII instead of extended characters. Gary DeRoest
TREE A:\>tree A:\ /f Folder PATH listing Volume serial number is 71FAE346 B421:254C A:. │ data │ ├───countries │ usa │ france │ brazil │ └───book The Fellowship of the Ring The Two Towers The Return of the King Gary DeRoest
File Storage, Efficiency, and Errors • Lost clusters • Cross-Linked files • Fragmentation Gary DeRoest
CHKDSK • Report disk space statistics • Repair lost cluster errors (/F) • Report on contiguousness of files • Display full path to all files on FAT (/V) • Locate bad sectors and recovers readable data (/R) Gary DeRoest
CHKDSK • Volumes must be locked down before changes can be made • Often requires a system restart Gary DeRoest
CHKDSK - FAT • Integrity and validity of directory table • directory structure • long file names • file dates • Trace files to verify space usage, file size • Correct discrepancies in FAT(1) and FAT(2) • Create report Gary DeRoest
CHKDSK - NTFS • Stage 1 • verify each file in MFT and which clusters it utilizes • Sage 2 • file date/time • directory association verification • Stage 3 • security verification Gary DeRoest
CHKDSK chkdsk a: The type of the file system is FAT. Volume Serial Number is AC13-7F6F Windows is verifying files and folders... File and folder verification is complete. Windows has checked the file system and found no problems. 1,457,664 bytes total disk space. 1,457,664 bytes available on disk. 512 bytes in each allocation unit. 2,847 total allocation units on disk. 2,847 allocation units available on disk. Gary DeRoest
SCANDISK • Repair (delete) crossed-linked files • Poor reporting capabilities Gary DeRoest
SCANDISK Gary DeRoest