DOS COMMANDS SYNTAX 2, TREASURE--> DOWNLOAD
21). COLOR = Change colors of the CMD window... |
---|
(EXPLAIN-COLOR) Sets the default console foreground and background colours. Syntax COLOR [background][foreground] Colour attributes are specified by 2 of the following hex digits. Each digit can be any of the following values: 0 = Black 8 = Gray 1 = Blue 9 = Light Blue 2 = Green A = Light Green 3 = Aqua B = Light Aqua 4 = Red C = Light Red 5 = Purple D = Light Purple 6 = Yellow E = Light Yellow 7 = White F = Bright White If no argument is given, COLOR restores the colour to what it was when CMD.EXE started. Colour values are assigned in the following order: The DefaultColor registry value. The CMD /T command line switch The current colour settings when cmd was launched The COLOR command sets ERRORLEVEL to 1 if an attempt is made to execute the COLOR command with a foreground and background colour that are the same. Examples: COLOR 07, white on black is the default. "COLOR 00" is an invalid option and will set %ERRORLEVEL% to 1 The COLOR command will change the color of all the text in the window. |
22). COMP = Compare the contents of two files or sets of files... |
---|
(EXPLAIN-COMP.exe) Compare two files (or sets of files). Display items which do not match. Syntax COMP [pathname1] [pathname2] [/D] [/A] [/L] [/N=number] [/C] Key pathname1 The path and filename of the first file(s) pathname2 The path and filename of the second file(s) /D Display differences in decimal format. (default) /A Display differences in ASCII characters. /L Display line numbers for differences. /N=number Compare only the first X number of lines in the file. /C do a case insensitive string comparison Running COMP with no parameters will result in a prompt for the 2 files and any options To compare sets of files, use wildcards in pathname1 and pathname2 parameters. When used with the /A option COMP is similar to the FC command but it displays the individual characters that differ between the files rather than the whole line. To compare files of different sizes, use /N= to compare only the first n lines (common portion of each file.) COMP will normally finish with a Compare more files (Y/N) prompt to suppress this: ECHO n|COMP |
23). CON2PRT = Connect or disconnect a Printer... |
---|
(EXPLAIN-CON2PRT.exe (Zero Admin Kit) Connect or disconnect a Printer All commands issued using this utility will affect only the user currently logged in. Con2prt is therefore ideal for managing NETWORK printer connections when used in a login script. Syntax CON2PRT /f CON2PRT /c \\PrintServer\PrintShare CON2PRT /cd \\PrintServer\PrintShare Key /f - remove all network printer connections /c - connect to \\PrintServer\PrintShare /cd - connect to and set PrintShare as the default printer Several switches can be combined in one command line. So you can remove all connections before adding new ones all in one command, you can only specify one default printer. For recent versions of Windows Microsoft now recommend the more flexible RUNDLL32 in preference to con2prt. The freeware utility AdPrintX is very similar to Con2Prt but has additional functionality, including compatibility with Windows 9x systems. |
24). COPY = Copy one or more files to another location... |
---|
(EXPLAIN-COPY) Copy one or more files to another location Syntax COPY source destination [options] COPY source1 + source2.. destination [options] Key source : Pathname for the file or files to be copied. /A : ASCII text file (default) /B : Binary file copy - will copy extended characters. destination : Pathname for the new file(s). /V : Verify that the new files were written correctly. /N : If at all possible, use only a short filename (8.3) when creating a destination file. This may be necessary when copying between disks that are formatted differently e.g NTFS and VFAT, or when archiving data to an ISO9660 CDROM. /Z : Copy files in restartable mode. If the copy is interrupted part way through, it will restart if possible. (use on slow networks) /Y : Suppress confirmation prompt (Windows 2000 only) /-Y : Enable confirmation prompt (Windows 2000 only) Prompt to overwrite destination file NT 4 will overwrite destination files without any prompt, Windows 2000 and above will prompt unless the COPY command is being executed from within a batch script. To force the overwriting of destination files under both NT4 and Windows2000 use the COPYCMD environment variable: SET COPYCMD=/Y This will turn off the prompt in Win2000 and will be ignored by NT4 (which overwrites by default) Binary copies "COPY /B ... " will copy all the files in binary mode , you can also put /B after any one file to copy just that file in binary. Combine files To combine files, specify a single file for the destination, but multiple files as the source. To specify more than one file use wildcards or list the files with a + in between each (file1+file2+file3) When copying multiple files in this way the first file must exist or else the copy will fail, a workaround for this is COPY null + file1 + file2 dest1 COPY will accept UNC pathnames Copy from the console (accept user input) COPY CON filename.txt Then type the input text followed by ^Z (Control key & Z) To do this in Powershell use the following function: function copycon { [system.console]::in.readtoend() } Examples: In the current folder COPY oldfile.doc newfile.doc Copy from a different folder/directory: COPY "C:\my work\some file.doc" "D:\New docs\newfile.doc" Specify the source only, with a wildcard will copy all the files into the current directory: COPY "C:\my work\*.doc" Specify the source with a wildcard and the destination as a single file, this is generally only useful with plain text files. COPY "C:\my work\*.txt" "D:\New docs\combined.txt" Quiet copy (no feedback on screen) COPY oldfile.doc newfile.doc >nul |
25). CSCcmd = Client-side caching (Offline Files... |
---|
(EXPLAIN-CSCcmd (Client-side caching command (Q884739 - Non Microsoft mirror) Run this utility on a client PC to configure offline files. Offline files (CSC) allow the client PC to access copies of network files while disconnected from the network/domain. Files can be synchronized with the network when connected. Syntax CSCCMD Option(s) Options: /ENABLE Enable Client-Side Caching (CSC) on this client. Requires Local Administrator rights /DISABLE Disable CSC, ensure all offline files are closed first. /Enum[: \\Server\Share [\Path]] [/RECURSE] Display all the shares in the local cache. With the /RECURSE option, this will display the contents of the shares within a parent share. /DISCONNECT:\\Server /DISCONNECT:\\Server\Share Disconnect a server or share from CSC on this client. /MOVESHARE:\\Server1\Share \\Server2\Share Move files and folders from one share to another in the cache. This is useful if the local cache must point to a new/renamed server location. /RESID Restamp all the entries in the Windows offline files (CSC) database with a new user security identifier (SID). useful when moving user accounts from an NT 4.0 domain to 2003. /ISENABLED Is CSC is enabled on this client PC. (synonym: /ISCSCENABLED) /PIN2:\\server\share\path [/USER] [/SYSTEM] [/USERINHERIT] [/SYSTEMINHERIT] Pin shared resources: Use the PIN2: /USER option to pin a file. This has the same result as using the Offline Files dialog box to cache the file. Use PIN2: /SYSTEM to specify that the share will be pinned via Group Policy. /USERINHERIT and /SYSTEMINHERIT] will determine how the pin data is inherited. /PIN2:filename /FILELIST [/UNICODE] [/USER] [/SYSTEM] [/USERINHERIT] [/SYSTEMINHERIT] Use a file to describe the objects to pin The file contains the UNC path of each object to pin. /FILELIST = the objects are separated by a carriage return/linefeed. /UNPIN2:\\server\share\path [/USER] [/SYSTEM] [/USERINHERIT] [/SYSTEMINHERIT] [/RECURSE] UnPin a shared resource or remove a shared resource from the local cache. with /RECURSE, CSCCMD will unpin all children of the path. with /RECURSE2, CSCCMD will unpin the path and children of the path. /UNPIN2:filename /FILELIST [/UNICODE] [/USER] [/SYSTEM] [/USERINHERIT] [/SYSTEMINHERIT] UnPin specific shared resources listed in filename. /FILELIST = the objects are separated by a carriage return/linefeed. /FILL:\\Server\Share\Path Copy server-side data to the local cache. /FILL:FileName /FILELIST [/UNICODE] Copy server-side data to the local cache using a file. /DELETE:\\Server\Share\Path [/RECURSE] [/RECURSE2] Delete a file, a directory, or a share from the local cache. Ensure that the directory/share is empty before you use this switch. with /RECURSE, CSCCMD tool only operates on the children of the path. with /RECURSE2, CSCCMD operates on the path and children of the path. /ISSERVEROFFLINE:\\Server Does CSC consider \\server to be offline. To get a reliable response from this switch, you must first open a share/file/directory from the local cache for \\server /SETSPACE:Bytes Specify the disk space in bytes to allocate to temporary offline files. These files are nonpinned, auto-cached files. This is similar to the function provided in the Offline Files dialog box. /CHECKDB [/QUICK] Examine the CSC database and display any database error flags. /QUICK will skip the enumeration and just display database errors. /EXTRACT[:\\Server\Share[\Path]] /TARGET:Path [/RECURSE] [/ONLYMODIFIED] [/STOPONERROR] Extract a file, a directory, or a directory tree from the local cache. This requires Local Administrator permissions /TARGET will specify a destination.(which need not already exist) /ONLYMODIFIED, extract only files that have been modified offline. /STOPONERROR, stop the extract if an error occurs. Offline files are most often used with laptops to provide access to data when on the move. Folder redirection can be setup to place the users My Documents on a server share, and then Offline Files can be set to copy and cache the data to the laptops C: drive. This arrangement allows faster synchronisation of files than a full roaming profile (which also synchronises other things you probably don't need on a laptop.) The /PIN2 switch does not copy the content of the shared resource into the local cache. Pinning is not sufficient to make the files available offline. After you use the /PIN2 switch, you must run CSCCMD /FILL to copy the content of the shared resource to the local cache. When using FILELIST, any white space at the start of a file is ignored. With the /UNICODE option, CSCCMD will create or read a file list in Unicode text format. CSC is available for Windows 2000/XP/2003. Examples Move a server share: csccmd /MOVESHARE:\\oldserver\share \\newserver\share csccmd /RESID |
26). CSVDE = Import or Export Active Directory data... |
---|
(EXPLAIN-CSVDE / LDIFDE (Directory Exchange) Import or Export Active Directory data to a file. The syntax of these two commands is identical, the difference being that one works with CSV files and one with LDIF files. Syntax Export to file: CSVDE [-f FileName] [options] LDIFDE [-f FileName] [options] Import from File: CSVDE -i [-f FileName] [options] LDIFDE -i [-f FileName] [options] Key -f Filename Input or Output filename -s servername The server to bind to -c FromDN ToDN Replace occurrences of FromDN to ToDN -v Verbose -j Path Folder to store log files -t Port_Number (default = 389) -? Help Export options -d RootDN The root of the LDAP search (Default to Naming Context) -r Filter LDAP search filter (Default to "(objectClass=*)") -p SearchScope Search Scope (Base/OneLevel/Subtree) -l list Attributes to look for in an LDAP search (comma separated List) -o list Attributes to omit from input (comma separated list) -g Disable Paged Search -m Enable the SAM logic on export -n Do not export binary values Import options -k Ignore 'Constraint Violation' and 'Object Already Exists' errors. Note to successfully import a file it must contain as a minimum The DN(distinguished name), DisplayName and ObjectClass Username/Password credentials -a Sets the command to run using the supplied user distinguished name and password. For example: "cn=yourname,dc=yourcompany,dc-com password" -b Sets the command to run as username domain password. The default is to run using the credentials of the currently logged on user. CSV (comma-separated value) format files can be read with MS Excel and are easily modified with a batch script. LDIF files (Ldap Data Interchange Format) are a cross-platform standard. This provides a method to populate Active Directory with data from other directory services. (e.g. Netscape NDS, Novell NDS/eDirectory, Oracle Internet Directory) Passwords For security reasons neither of these tools will export passwords. When you import an account it is given a null password, if the domain has a password length policy, then the account will be disabled (You can re-enable accounts in bulk with a script) Compatibility CSVDE and LDIFDE are supplied with Windows 2000/2003 Server but can also be run on Win2000 Professional and XP Professional (i.e run remotely against the Active Directory Server.) Examples Export the whole domain CSVDE -f MyDomain.csv Export all users with a particular surname: CSVDE -f MyUsers.csv -r (and(objectClass=User)(sn=Surname)) Import the whole domain and create C:\MyLogfiles\csv.log and C:\MyLogfiles\csv.err CSVDE -i -f MyDomain.csv -j C:\MyLogfiles\ |
27). CLEARMEM = Clear memory leaks... |
---|
(EXPLAIN - ) |
28). CLS = Clear the screen... |
---|
(EXPLAIN - cls) Type: Internal (2.0 and later) Syntax: CLS Purpose: Clears (erases) the screen. Discussion Erases all characters and graphics from the screen; however, it does not change the currently-set screen attributes. Example Enter cls to clear the screen of everything but the command prompt and the cursor. |
29). CLUSTER = Windows Clustering... |
---|
(EXPLAIN - ) |
30). COMPACT = Compress files or folders on an NTFS partition... |
---|
(EXPLAIN - ) |
31). COMPRESS = Compress individual files on an NTFS partition... |
---|
(EXPLAIN - ) |
32). CONVERT = Convert a FAT drive to NTFS... |
---|
(EXPLAIN - ) |
33). DNSSTAT = DNS Statistics... |
---|
(EXPLAIN - ) |
34). DATE = Display or set the date... |
---|
(EXPLAIN - DATE) Display or change the date Syntax to display the date DATE /T to set the system date DATE or DATE A typical output from DATE /T is "Mon 11/09/2000" but this is dependent on the country code. The date formats for different country codes are as follows: Country or language CountryCode Date format Time format United States 001 01/23/1997 5:35:00.00p Czechoslovakia 042 23.01.1997 17:35:00 France 033 23.01.1997 17:35:00 Germany 049 23.01.1997 17:35:00 Latin America 003 23/01/1997 5:35:00.00p International English 061 23/01/1997 17:35:00.00 Portugal 351 23-01-1997 17:35:00 Finland 358 23.1.1997 17.35.00 Switzerland 041 23.01.97 17 35.00 Norway 047 23.01.97 17:35:00 Belgium 032 23/01/97 17:35:00 Brazil 055 23/01/97 17:35:00 Italy 039 23/01/97 17.35.00 United Kingdom 044 23/01/97 17:35:00.00 Denmark 045 23-01-97 17.35.00 Netherlands 031 23-01-97 17:35:00 Spain 034 3/12/98 17:35:00 Hungary 036 1997.01.23 17:35:00 Canadian-French 002 1997-01-23 17:35:00 Poland 048 1997-01-23 17:35:00 Sweden 046 1997-01-23 17.35.00 Date Formatting In Control Panel Regional settings a short date STYLE can be set. This can be used to change the date separator, the order (e.g. dd/mm/yyyy or mm/dd/yyyy) and the number of characters used to display days and months. Date Format information in the registry The Country Code is a setting in the registry: This can be read using REG.exe as follows FOR /F "TOKENS=3 delims= " %%G IN ('REG QUERY "HKEY_CURRENT_USER\Control Panel\International\iCountry"') DO (SET _country=%%G) The date separator is also a registry setting This can be read using REG.exe as follows FOR /F "TOKENS=3 delims= " %%G IN ('REG QUERY "HKEY_CURRENT_USER\Control Panel\International\sDate"') DO SET _date_sep=%%G If Command Extensions are disabled DATE will not support the /T switch |
35). DEFRAG = Defragment hard drive... |
---|
(EXPLAIN - DEFRAG) Defragment hard drive. Syntax DEFRAG Options volume drive letter or mount point (d: or d:\vol\mountpoint) -a Analyze only -f Force defragmentation even if free space is low -v Verbose output Example: DEFRAG c: -f |
36). DEL = Delete one or more files... |
---|
(EXPLAIN - DEL) Delete one or more files. Syntax DEL [options] [/A:file_attributes] files_to_delete Key files_to_delete : This may be a filename, a list of files or a Wildcard options /P Give a Yes/No Prompt before deleting. /F Ignore read-only setting and delete anyway (FORCE) /S Delete from all Subfolders (DELTREE) /Q Quiet mode, do not give a Yes/No Prompt before deleting. /A Select files to delete based on file_attributes file_attributes: R Read-only -R NOT Read-only S System -S NOT System H Hidden -H NOT Hidden A Archive -A NOT Archive Wildcards: These can be combined with part of a filename * Match any characters ? Match any ONE character Examples: To delete HelloWorld.TXT DEL HelloWorld.TXT To delete "Hello Big World.TXT" DEL "Hello Big World.TXT" To delete all files that start with the letter A DEL A* To delete all files that end with the letter A DEL *A.* To delete all files with a .DOC extension DEL *.DOC To delete all read only files DEL /a:R * To delete all files including any that are read only DEL /F * Folders If a folder name is given instead of a file, all files in the folder will be deleted, but the folder itself will not be removed. Temporary Files You should clear out TEMP files on a regular basis - this is best done at startup when no applications are running. To delete all files in all subfolders of C:\temp\ but leave the folder structure intact: DEL /F /S /Q %TEMP% When clearing out the TEMP directory it is not generally worthwhile removing the subfolders too - they don't use much space and constantly deleting and recreating them can potentially increase fragmentation within the Master File Table. Deleting a file will not prevent third party utilities from un-deleting it again, however you can turn any file into a zero-byte file to destroy the file allocation chain like this: TYPE nul > C:\examples\MyFile.txt DEL C:\examples\MyFile.txt Undeletable Files Files are sometimes created with the very long filenames or reserved names: CON, AUX, COM1, COM2, COM3, COM4, LPT1, LPT2, LPT3, PRN, NUL To delete these use the syntax: DEL \\.\C:\somedir\LPT1 Alternatively SUBST a drive letter to the folder containing the file. If a file (or folder) still appears to be 'undeletable' this is often caused by the indexing service. Right click the file you need to delete, choose properties, advanced and untick "allow indexing" you will then be able to delete the file. To cure the problem permanently - Control Panel, Add/Remove programs, Win Accessories, indexing service. Delete Locked files (Typically IE temp files or the Offline cache) This works on any version of NT, 2000 or XP Close all applications Open a command prompt Click Start, and then Shut Down Simultaneously press CTRL+SHIFT+ALT. While you keep these keys pressed, click Cancel in the Shut Down Windows dialog box. In the command prompt window, navigate to the cache location, and delete all files from the folder (DEL /s) At the command prompt, type explorer, and then press ENTER. DELTREE Previous versions of Windows had the DELTREE command that deletes all files and sub folders. DEL /s will delete all files RD /s will remove all files and folders including the root folder. :: Remove all files and subfolders but NOT the root folder :: From tip 617 at JsiFAQ.com @echo off pushd %1 del /q *.* for /f "Tokens=*" %%G in ('dir /B') do rd /s /q "%%G" popd Normally DEL will display a list of the files deleted, if Command Extensions are disabled; it will instead display a list of any files it cannot find. ERASE is a synonym for DEL |
37). DELPROF = Delete NT user profiles... |
---|
(EXPLAIN - DELPROF) Delete windows user profiles. Syntax DELPROF [options] Key /Q Quiet, no confirmation. /I Ignore errors and continue deleting. /P Prompts for confirmation before deleting each profile. /C:\\computer_name Delete profiles on a remote computer. /D:Number_of_days Only delete profiles that have been inactive for 'X' Number of days (or greater) /R Delete roaming profile cache only ## ## = New in version 5.2 (XP resource kit) Example: delprof /D:14 |
PLEASE POST YOUR COMMENT |
38). DELTREE = Delete a folder and all subfolders... |
---|
(EXPLAIN - DEL) Delete one or more files. Syntax DEL [options] [/A:file_attributes] files_to_delete Key files_to_delete : This may be a filename, a list of files or a Wildcard options /P Give a Yes/No Prompt before deleting. /F Ignore read-only setting and delete anyway (FORCE) /S Delete from all Subfolders (DELTREE) /Q Quiet mode, do not give a Yes/No Prompt before deleting. /A Select files to delete based on file_attributes file_attributes: R Read-only -R NOT Read-only S System -S NOT System H Hidden -H NOT Hidden A Archive -A NOT Archive Wildcards: These can be combined with part of a filename * Match any characters ? Match any ONE character Examples: To delete HelloWorld.TXT DEL HelloWorld.TXT To delete "Hello Big World.TXT" DEL "Hello Big World.TXT" To delete all files that start with the letter A DEL A* To delete all files that end with the letter A DEL *A.* To delete all files with a .DOC extension DEL *.DOC To delete all read only files DEL /a:R * To delete all files including any that are read only DEL /F * Folders If a folder name is given instead of a file, all files in the folder will be deleted, but the folder itself will not be removed. Temporary Files You should clear out TEMP files on a regular basis - this is best done at startup when no applications are running. To delete all files in all subfolders of C:\temp\ but leave the folder structure intact: DEL /F /S /Q %TEMP% When clearing out the TEMP directory it is not generally worthwhile removing the subfolders too - they don't use much space and constantly deleting and recreating them can potentially increase fragmentation within the Master File Table. Deleting a file will not prevent third party utilities from un-deleting it again, however you can turn any file into a zero-byte file to destroy the file allocation chain like this: TYPE nul > C:\examples\MyFile.txt DEL C:\examples\MyFile.txt Undeletable Files Files are sometimes created with the very long filenames or reserved names: CON, AUX, COM1, COM2, COM3, COM4, LPT1, LPT2, LPT3, PRN, NUL To delete these use the syntax: DEL \\.\C:\somedir\LPT1 Alternatively SUBST a drive letter to the folder containing the file. If a file (or folder) still appears to be 'undeletable' this is often caused by the indexing service. Right click the file you need to delete, choose properties, advanced and untick "allow indexing" you will then be able to delete the file. To cure the problem permanently - Control Panel, Add/Remove programs, Win Accessories, indexing service. Delete Locked files (Typically IE temp files or the Offline cache) This works on any version of NT, 2000 or XP Close all applications Open a command prompt Click Start, and then Shut Down Simultaneously press CTRL+SHIFT+ALT. While you keep these keys pressed, click Cancel in the Shut Down Windows dialog box. In the command prompt window, navigate to the cache location, and delete all files from the folder (DEL /s) At the command prompt, type explorer, and then press ENTER. DELTREE Previous versions of Windows had the DELTREE command that deletes all files and sub folders. DEL /s will delete all files RD /s will remove all files and folders including the root folder. :: Remove all files and subfolders but NOT the root folder :: From tip 617 at JsiFAQ.com @echo off pushd %1 del /q *.* for /f "Tokens=*" %%G in ('dir /B') do rd /s /q "%%G" popd Normally DEL will display a list of the files deleted, if Command Extensions are disabled; it will instead display a list of any files it cannot find. ERASE is a synonym for DEL. |
39). DevCon = Device Manager Command Line Utility... |
---|
(EXPLAIN - DEVCON.exe) Device Manager Syntax devcon.exe [-r] [-m:\\machine] command [arg...] devcon.exe help command Key -r Reboot the machine after command is complete, if needed. machine Name of target machine. command The command to perform (see below). arg... One or more arguments if required by command. Commands: classfilter Allow modification of class filters. classes List all device setup classes. disable Disable devices that match the specific hardware/instance ID. driverfiles List driver files installed for devices. drivernodes List all the driver nodes of devices. enable Enable devices that match the specific hardware/instance ID. find Find devices that match the specific hardware/instance ID. findall Find devices including those that are not present. help Display this information. hwids List hardware ID's of devices. install Manually install a device. listclass List all devices for a setup class. reboot Reboot local machine. remove Remove devices that match the specific hardware/instance ID. rescan Scan for new hardware. resources List hardware resources of devices. restart Restart devices that match the specific hardware/instance ID. stack List expected driver stack of devices. status List running status of devices. update Manually update a device. UpdateNI Manually update a device without user prompt SetHwID Add, delete, and change the order of hardware IDs of root-enumerated devices. DevCon is not redistributable. It is provided for use as a debugging and development tool. Examples: List all known PCI devices on the computer pc64. devcon -m:\\pc64 find pci\* Install a new instance of the Microsoft loopback adaptor and restart if required. This creates a new root-enumerated device node with which you can install a "virtual device," such as the loopback adaptor. devcon -r install %WINDIR%\Inf\Netloop.inf *MSLOOP List all known setup classes. Displays both the short name and the descriptive name. devcon classes Lists files that are associated with each device in the ports setup class. devcon driverfiles =ports Disable all devices that have a hardware ID that ends in "MSLOOP" (including "*MSLOOP"). devcon disable *MSLOOP List all compatible drivers for the device ROOT\PCI_HAL\PNP0A03. This can be used to determine why an integral device information (.inf) file was chosen, instead of a third-party .inf file. devcon drivernodes @ROOT\PCI_HAL\PNP0A03 Enable all devices that have a hardware ID of "*MSLOOP". The single quotation mark indicates that the hardware ID must be taken literally (in other words, the asterisk ["*"] actually is an asterisk; it is not a wildcard character). devcon enable '*MSLOOP List device instances of all devices that are present on the local computer. devcon find * List all known peripheral component interconnect (PCI) devices that are on the local computer (this command assumes that a device is PCI if it has a hardware ID that is prefixed by "PCI\"). devcon find pci\* List devices that are a member of the ports setup class and that contain "PNP" in their hardware ID. devcon find =ports *pnp* List devices that are present that are a member of the ports setup class and that are in the "root" branch of the enum tree (the instance ID is prefixed by "root\"). Note that you should not make any programmatic assumption about how an instance ID is formatted. To determine root devices, you can look at device status bits. This feature is included in DevCon to aid in debugging. devcon find =ports @root\* List "nonpresent" devices and devices that are present for the ports class. This includes devices that have been removed, devices that have been moved from one slot to another and, in some cases, devices that have been enumerated differently due to a BIOS change. devcon findall =ports List all devices that are present for each class named (in this case, USB and 1394). devcon listclass usb 1394 Remove all USB devices. Devices that are removed are listed with their removal status. devcon remove @usb\* Rescan for new Plug and Play devices. devcon rescan List the resources that are used by all devices in the ports setup class. devcon resources =ports Restart the loopback adaptor ROOT\*MSLOOP\0000. The single quotation mark in the command indicates that the instance ID must be taken literally. devcon restart =net @'ROOT\*MSLOOP\0000 List all hardware IDs of mouse class devices on the system. devcon hwids=mouse Assign the hardware ID, beep, to the legacy beep device. devcon sethwid @ROOT\LEGACY_BEEP\0000 := beep List the status of each device present that has an instance ID that begins with "pci\". devcon status @pci\* List the status of an Advanced Configuration and Power Interface (ACPI)-enumerated serial port. devcon status @ACPI\PNP0501\1 List the status of all COM ports. devcon status *PNP05* Errorlevels returned by DevCon.exe: 0 = success. 1 - restart is required. 2 = failure. 3 = syntax error. |
40). DIR = Display a list of files and folders... |
---|
(EXPLAIN - DIR) Display a list of files and subfolders Syntax DIR [pathname(s)] [display_format] [file_attributes] [sorted] [time] [options] Key [pathname] The drive, folder, and/or files to display, this can include wildcards: * Match any characters ? Match any ONE character [display_format] /P Pause after each screen of data. /W Wide List format, sorted horizontally. /D Wide List format, sorted by vertical column. [file_attributes] /A: /A:D Folder /A:-D NOT Folder /A:R Read-only /A:-R NOT Read-only /A:H Hidden /A:-H NOT Hidden /A:A Archive /A:-A NOT Archive /A Show all files several attributes may be combined e.g. /A:HD-R [sorted] Sorted by /O: /O:N Name /O:-N Name /O:S file Size /O:-S file Size /O:E file Extension /O:-E file Extension /O:D Date & time /O:-D Date & time /O:G Group folders first /O:-G Group folders last several attributes may be combined e.g. /O:GEN [time] /T: the time field to display & use for sorting /T:C Creation /T:A Last Access /T:W Last Written (default) [options] /S include all subfolders. /R Display alternate data streams. (Vista and above) /B Bare format (no heading, file sizes or summary). /L use Lowercase. /Q Display the owner of the file. /N long list format where filenames are on the far right. /X As for /N but with the short filenames included. /C Include thousand separator in file sizes. /-C don't include thousand separator in file sizes. /4 Display four-digit years The switches above may be preset by adding them to an environment variable called DIRCMD. For example: SET DIRCMD=/O:N /S Override any preset DIRCMD switches by prefixing the switch with - For example: DIR *.* /-S Upper and Lower Case filenames: Filenames longer than 8 characters - will always display the filename with mixed case as entered. Filenames shorter than 8 characters - may display the filename in upper or lower case - this may vary from one client to another (registry setting) To obtain a bare DIR format (no heading or footer info) but retain all the details, pipe the output of DIR into FIND, this assumes that your date separator is / DIR c:\temp\*.* | FIND "/" FOR /f "tokens=*" %%G IN ('dir c:\temp\*.* ^| find "/"') DO echo %%G Normally DIR /b will return just the filename, however when displaying subfolders with DIR /b /s the command will return a full pathname. Checking filesize during a download (to monitor progress of a large download) TYPE file_being_downloaded >NUL DIR file_being_downloaded Since TYPE won't lock the file_being_downloaded in any way, this doesn't pose a threat to the download itself. On Windows Vista and later, a list of alternate data streams can be obtained using DIR /R, On earlier operating systems, the SysInternals utility streams can be used instead. |
No comments:
Post a Comment