DOS COMMANDS SYNTAX 4, TREASURE--> DOWNLOAD
61). FC = Compare two files... |
---|
(EXPLAIN - FC.exe) Compare the contents of two files or sets of files. Display any lines which do NOT match. Syntax FC /B pathname1 pathname2 FC [options] pathname1 pathname2 Key /B : Perform a binary comparison. options /C : Do a case insensitive string comparison /A : Displays only first and last lines for each set of differences. /U : Compare files as UNICODE text files. /L : Compares files as ASCII text. (default) /N : Display line numbers (ASCII only) /LBn: Limit the number of lines that will be read, "n" sets a maximum number of mismatches after which the File Comparison will abort (resync failed) When FC aborts (resync failed) then "n" number of mismatches will be shown. /nnnn : Specify a number of consecutive lines that must match after a mismatch. This can be used to prevent the display of the two files from getting too out of sync /T : Do not expand tabs to spaces. /W : Compress white space (tabs and spaces) for comparison. To compare sets of files, use wildcards in pathname1 and pathname2 parameters. Powershell also has an Alias FC for the Format-Custom cmdlet, therefore to run the 'old' FC under powershell you need to explicitly run C:\windows\system32\fc.exe To identify 2 identical files use this syntax: FC file1.txt file2.txt | FIND "FC: no dif" > nul IF ERRORLEVEL 1 goto :s_files_are_different Example: If two files are compared and the four lines of text match as follows 1: different 2: same 3: same 4: different Specifying /nnnn =2 the file compare will display the 4th line and continue Specifying /nnnn =3 the file compare will halt at the 4th line (files too different) Specifying /LB1 the file compare will halt after the first line |
62). FIND = Search for a text string in a file... |
---|
(EXPLAIN - FIND) Search for a text string in a file & display all the lines where it is found. Syntax FIND [/V] [/C] [/N] [/I] "string" [pathname(s)] key /V : Display all lines NOT containing the specified string. /C : Count the number of lines containing the string. /N : Display Line numbers. /I : Ignore the case of characters when searching for the string. "string" : The text string to find (must be in quotes). [pathname] : A drive, file or files to search. If a [pathname] is not specified, FIND will prompt for text input or will accept text piped from another command. (use CTRL-Z to end manual text input) Examples: If names.txt contains the following: Joe Bloggs, 123 Main St, Dunoon Arnold Jones, 127 Scotland Street, Edinburgh To search for "Jones" in names.txt FIND "Jones" names.txt ---------- NAMES.TXT Arnold Jones, 127 Scotland Street, Edinburgh If you want to pipe a command into FIND use this syntax TYPE names.txt | FIND "Jones" You can also redirect like this FIND /i "Jones" < names.txt >logfile.txt To search a folder for files that contain a given search string FOR %G IN (*.txt) do (find /n /i "SearchWord" "%G") |
63). FINDSTR = Search for strings in files... |
---|
(EXPLAIN - FINDSTR) Search for strings in files. Syntax FINDSTR [options] [/F:file] [/C:string] [/G:file] [/D:DirList] [/A:color_attr] [/OFF[LINE]] [string(s)] [pathname(s)] Key string Text to search for. pathname(s) The file(s) to search. /C:string Use string as a literal search string. /G:file Get search string from a file (/ stands for console). /F:file Get a list of pathname(s) from a file (/ stands for console). /A:color_attr Display filenames in colour (2 hex digits) /d:dirlist Search a comma-delimited list of directories. options may be any combination of the following switches: /I Case-insensitive search. /S Search subfolders. /P Skip any file that contains non-printable characters /OFF[LINE] Do not skip files with the OffLine attribute set. /L Use search string(s) literally. /R Use search string(s) as regular expressions.(default) /B Match pattern if at the Beginning of a line. /E Match pattern if at the END of a line. /X Print lines that match exactly. /V Print only lines that do NOT contain a match. /N Print the line number before each line that matches. /M Print only the filename if a file contains a match. /O Print character offset before each matching line. When the search string contains multiple words (separated with spaces) then FINDSTR will show show lines that contains any one word - (an OR of each word) - this behaviour is reversed if the string argument is prefixed with /C. Regular Expressions (Searching for patterns of text) The FINDSTR syntax notation can use the following metacharacters which have special meaning either as an operator or delimiter. . Wildcard: any character * Repeat: zero or more occurances of previous character or class ^ Line position: beginning of line $ Line position: end of line [class] Character class: any one character in set [^class] Inverse class: any one character not in set [x-y] Range: any characters within the specified range \x Escape: literal use of metacharacter x \ Metacharacters are most powerful when they are used together. For example, the combination of the wildcard character (.) and repeat (*) character is similar in effect to the filename wildcard (*.*) .* Match any string of characters The .* expression may be useful within a larger expression, for example f.*ing will match any string beginning with F and ending with ing. Examples: Search for "granny" OR "Smith" in MyFile.txt FINDSTR "granny Smith" MyFile.txt Search for "granny Smith" in MyFile.txt (effectively the same as the FIND command) FINDSTR /C:"granny Smith" MyFile.txt Search every file in the current folder and all subfolders for the word "Smith", regardless of upper/lower case, note that /S will only search below the current directory: FINDSTR /s /i smith *.* Search all the text files in the current folder for the string "fiona", display the filenames in White on Green. FINDSTR /A:2F /C:fiona *.txt To find every line containing the word SMITH, preceeded by any number of spaces, and to prefix each line found with a consecutive number: FINDSTR /b /n /c:" *smith" MyFile.txt Finding a string only if surrounded by the standard delimiters Find the word "computer", but not the words "supercomputer" or "computerise": FINDSTR "\ Find any words that begin with the letters 'comp', such as 'computerise' or 'compete' FINDSTR "\ Errorlevel When an item is not found FINDSTR will return an errorlevel >0 Echo 12G6 |FindStr /R "[0-9]" If %ERRORLEVEL% EQU 0 echo The string contains one or more numeric characters Echo 12G6 |FindStr /R "[^0-9]" If %ERRORLEVEL% EQU 0 echo The string contains one or more non numeric characters Bugs In early versions of FindStr /F:file a path length of more than 80 chars will be truncated. |
64). FOR /F = Loop command: against a set of files... |
---|
(EXPLAIN - FOR /F) Loop command: against a set of files - conditionally perform a command against each item. Syntax FOR /F ["options"] %%parameter IN (filenameset) DO command FOR /F ["options"] %%parameter IN ("Text string to process") DO command Key options: delims=xxx The delimiter character(s) (default = a space) skip=n A number of lines to skip at the beginning of the file. (default = 0) eol=; Character at the start of each line to indicate a comment The default is a semicolon ; tokens=n Specifies which numbered items to read from each line (default = 1) usebackq Specify `back quotes`: - Use double quotes to quote long file names in filenameset. - Use single quotes for 'Text string to process' (useful if the text string contains double quotes) Filenameset A set of one or more files. Wildcards may be used. If (filenameset) is a period character (.) then FOR will loop through every file in the folder. command The command to carry out, including any command-line parameters. %%parameter A replaceable parameter: in a batch file use %%G (on the command line %G) FOR /F processing of a text file consists of reading the file, one line of text at a time and then breaking the line up into individual items of data called 'tokens'. The DO command is then executed with the parameter(s) set to the token(s) found. By default, /F breaks up the line at each blank space " ", and any blank lines are skipped, this default parsing behavior can be changed by applying one or more of the "options" parameters. The option(s) must be contained within "a pair of quotes" Within a FOR loop the visibility of FOR variables is controlled via SETLOCAL EnableDelayedExpansion Tokens tokens=2,4,6 will cause the second, fourth and sixth items on each line to be processed tokens=2-6 will cause the second, third, fourth, fifth and sixth items on each line to be processed tokens=* will cause all items on each line to be processed tokens=3* will cause the 3rd and all subsequent items on each line to be processed Each token specified will cause a corresponding parameter letter to be allocated. If the last character in the tokens= string is an asterisk, then additional parameters are allocated for all the remaining text on the line. Delims More than one delimiter may be specified so a string like 'abcd+efg+hijk+lmno;pqr;stu+vwzyz' can be broken up using "delims=;+". You can use any character as a delimiter, but they are case sensitive. If you don't specify delims it will default to "delims= n.b. some text editors will enter the TAB character as a series of spaces, specifying more than one delimiter has been known to cause problems with some data sets. usebackq This option is useful when dealing with a filenameset that is a long filename containing spaces, it allows you to put double quotes around the filename. The backquote character ` is just below the ESC key on most keyboards. eol The default end-of-line character is a semicolon ';' when the FOR command reads a text file (or even a character string), any line that STARTS with the eol character will be ignored. In other words it is treated as a comment. Use eol=X to change the eol character to X. Most often you will want to turn this feature off so that every line of your data file is processed, in theory "eol=" should turn this feature off, but in practice this fails to work correctly so instead set eol to some unusual character that you don't expect to ever be in the data file e.g. "eol=€" or "eol=¬". Examples Extracting data from this text file: January,Snowy,02 February,Rainy,15 March,Sunny,25 FOR /F "tokens=1,3 delims=," %%G IN (weather.txt) DO @echo %%G %%H The tricky part is splitting up each the line into the right tokens, in this case I'm splitting on the comma character ',' this splits the line into 3 chunks of text and we pull out the first and third items with "tokens=1,3" token1 , token2 , token3 %%G January 02 February 15 March 25 %%G is declared in the FOR statement and %%H is implicitly declared via the tokens= option. You can specify up to 26 tokens via the tokens= line, provided this does not cause an attempt to declare a parameter higher than the letter 'Z'. FOR parameter names are global, so in complex scripts which call one FOR statement from within another FOR statement you can refer to both sets of parameters. You cannot have more than 26 parameters active at any one time. Parse a text string: A string of text will be treated just like a single line of input from a file, the string must be enclosed in double quotes (or single quotes with usebackq). Echo just the date from the following string FOR /F "tokens=4 delims=," %%G IN ("deposit,$4500,123.4,12-AUG-09") DO @echo Date paid %%G Parse the output of a command: FOR /F %%G IN ('"C:\program Files\command.exe"') DO ECHO %%G Parse the contents of a file: FOR /F "tokens=1,2* delims=," %%G IN (C:\MyDocu~1\mytex~1.txt) DO ECHO %%G FOR /F "usebackq tokens=1,2* delims=," %%G IN ("C:\My Documents\my textfile.txt") DO ECHO %%G Filenameset To specify an exact set of files to be processed, such as all .MP3 files in a folder including subfolders and sorted by date - just use the DIR /b command to create the list of filenames ~ and use this variant of the FOR command syntax. Unicode Many of the newer commands and utilities (e.g. WMIC) output text files in unicode format, these cannot be read by the FOR command which expects ASCII. To convert the file format use the TYPE command. |
65). FOR /F = Loop command: against the results of another command... |
---|
(EXPLAIN - FOR /F) Loop command: against the results of another command. Syntax FOR /F ["options"] %%parameter IN ('command_to_process') DO command Key options: delims=xxx The delimiter character(s) (default = a space) skip=n A number of lines to skip at the beginning. (default = 0) eol=; Character at the start of each line to indicate a comment The default is a semicolon ; tokens=n Specifies which numbered items to read from each line (default = 1) usebackq Specify `back quotes` the command_to_process is placed in `BACK quotes` instead of 'straight' quotes command_to_process : The output of the 'command_to_process' is passed into the FOR parameter. command : The command to carry out, including any command-line parameters. %%parameter : A replaceable parameter: in a batch file use %%G (on the command line %G) FOR /F processing of a command consists of reading the output from the command one line at a time and then breaking the line up into individual items of data or 'tokens'. The DO command is then executed with the parameter(s) set to the token(s) found. The FOR command is the answer to innumerable questions where you want to take the output of some command, store it in a variable (%%G) then do something with the result. For example the PING command returns serveral lines including one like: Packets: Sent = 4, Received = 4, Lost = 0 (0% Loss), To select that one line of output, you can search for the text "Loss" (which is always present), then use the Tokens parameter to select the number of lost packets, here this is 0 but it will vary each time you run the command. set _ping_cmd=ping -n 5 127.0.0.1 FOR /f "tokens=4 delims=(=" %%G IN ('%_ping_cmd% ^|find "loss"') DO echo Result is [%%G] The tricky part is always splitting up the line of interest into the right tokens, in this case I'm splitting on the characters '=' and '(' these two characters split the line into 5 chunks of text and we pull out the fourth one with "tokens=4" By default, /F breaks up the command output at each blank space, and any blank lines are skipped. You can override this default parsing behavior by specifying the "options" parameter. The options must be contained within "quotes" usebackq This option is useful when dealing with a command that already contains one or more straight quotes. The backquote character ` is just below the ESC key on most keyboards. See the FOR /F page for other effects of usebackq. Tokens tokens=2,4,6 will cause the second, fourth and sixth items on each line to be processed tokens=2-6 will cause the second, third, fourth, fifth and sixth items on each line to be processed tokens=* will cause all items on each line to be processed tokens=3* will cause the 3rd and all subsequent items on each line to be processed Each token specified will cause a corresponding parameter letter to be allocated. If the last character in the tokens= string is an asterisk, then additional parameters are allocated for all the remaining text on the line. Delims More than one delimiter may be specified so a string like 'abcd+efg+hijk;lmno;pqr' can be broken up using "delims=;+". You can use any character as a delimiter, but they are case sensitive. If you don't specify delims it will default to "delims= n.b some text editors will enter the TAB character as a series of spaces, specifying more than one delimiter has been known to cause problems with some data sets. eol The default end-of-line character is a semicolon ';' when the FOR command reads a text file (or even a character string), any line that STARTS with the eol character will be ignored. In other words it is treated as a comment. Use eol=X to change the eol character to X. Most often you will want to turn this feature off so that every line of your data file is processed, in theory "eol=" should turn this feature off, but in practice this fails to work correctly so instead set eol to some unusual character that you don't expect to ever be in the data file e.g. "eol=€" or "eol=¬". Examples: To ECHO from the command line, the name of every environment variable. FOR /F "delims==" %G IN ('SET') DO @Echo %G The same command with usebackq: FOR /F "usebackq delims==" %G IN (`SET`) DO @Echo %G To put the Windows Version into an environment variable @echo off ::parse the VER command FOR /F "tokens=4*" %%G IN ('ver') DO SET _version=%%G :: show the result echo %_version% List all the text files in a folder FOR /F "tokens=*" %%G IN ('dir /b C:\docs\*.txt') DO echo %%G FOR /F "tokens=*" %%G IN ('dir/b ^"c:\program files\*.txt^"') DO echo %%G In the example above the long filename has to be surrounded in "quotes" these quotes have to be escaped using ^ The "tokens=*" has been added to match all parts of any long filenames returned by the DIR command. Although the above is a trivial example, being able to set %%G equal to each long filename in turn could allow much more complex processing to be done. More examples can be found on the Syntax / Batch Files pages and the other FOR pages below. |
66). FOR = Loop command: all options Files, Directory, List... |
---|
(EXPLAIN - FOR) Conditionally perform a command several times. syntax-FOR-Files FOR %%parameter IN (set) DO command syntax-FOR-Files-Rooted at Path FOR /R [[drive:]path] %%parameter IN (set) DO command syntax-FOR-Folders FOR /D %%parameter IN (folder_set) DO command syntax-FOR-List of numbers FOR /L %%parameter IN (start,step,end) DO command syntax-FOR-File contents FOR /F ["options"] %%parameter IN (filenameset) DO command FOR /F ["options"] %%parameter IN ("Text string to process") DO command syntax-FOR-Command Results FOR /F ["options"] %%parameter IN ('command to process') DO command The operation of the FOR command can be summarised as... Take a set of data Make a FOR Parameter %%G equal to some part of that data Perform a command (optionally using the parameter as part of the command). Repeat for each item of data If you are using the FOR command at the command line rather than in a batch program, specify %parameter instead of %%parameter. FOR Parameters The first parameter has to be defined using a single character, I tend to use the letter G. e.g. FOR %%G IN ... In each iteration of a FOR loop, the IN ( ....) clause is evaluated and %%G set to a different value If this results in a single value then %%G is set equal to that value and the command is performed. If this results in a multiple values then extra parameters are implicitly defined to hold each. These are automatically assigned in alphabetical order %%H %%I %%J ...(implicit parameter definition) Also if the parameter refers to a file, you can use an enhanced variable reference to quickly extract the filename/path/date/size. Example FOR /F "tokens=1-5" %%G IN ("This is a long sentence") DO @echo %%G %%H %%J will result in the output This is long You can of course pick any letter of the alphabet other than %%G. %%G is a good choice because it does not conflict with any of the pathname format letters (a, d, f, n, p, s, t, x) and provides the longest run of non-conflicting letters for use as implicit parameters. G > H > I > J > K > L > M Running multiple commands in a FOR loop Within a FOR loop, variables are expanded at the start of the loop and don't update until the entire DO section has completed. The following example counts the files in the current folder, but %count% always returns 1: @echo off SET count=1 FOR /f "tokens=*" %%G IN ('dir /b') DO ( echo %count%:%%G set /a count+=1 ) To update variables within each iteration of the loop we must either use EnableDelayedExpansion or else use the CALL :subroutine mechanism as shown below: @echo off SET count=1 FOR /f "tokens=*" %%G IN ('dir /b') DO (call :subroutine"%%G") GOTO :eof :subroutine echo %count%:%1 set /a count+=1 GOTO :eof Nested FOR commands FOR commands can be nested FOR %%G... DO (for %%U... do ...) when nesting commands choose a different letter for each part. you can then refer to both parameters in the final DO command. If Command Extensions are disabled, the FOR command will only support the basic syntax with no enhanced variables: FOR %%parameter IN (set) DO command [command-parameters] |
67). FORFILES = Batch process multiple files... |
---|
(EXPLAIN - FORFILES.exe) Select a file (or set of files) and execute a command on each file. Batch processing. Syntax FORFILES [/p Path] [/m Mask] [/s] [/c Command] [/d [+ | -] {dd/MM/yyyy | dd}] Key /p Path The Path to search (default=current folder) /s Recurse into sub-folders /C command The command to execute for each file. Wrap the command string in double quotes. Default = "cmd /c echo @file" The Command variables listed below can also be used in the command string. /D date Select files with a last modified date greater than or equal to (+), or less than or equal to (-), the specified date using the "dd/MM/yyyy" format; or selects files with a last modified date greater than or equal to (+) the current date plus "dd" days, or less than or equal to (-) the current date minus "dd" days. A valid "dd" number of days can be any number in the range of 0 - 32768. "+" is taken as default sign if not specified. Command Variables: @file The name of the file. @fname The file name without extension. @ext Only the extension of the file. @path Full path of the file. @relpath Relative path of the file. @isdir Returns "TRUE" if a file type is a directory, and "FALSE" for files. @fsize Size of the file in bytes. @fdate Last modified date of the file. @ftime Last modified time of the file. To include special characters in the command line, use the hex code for the character in 0xHH format (ex. 0x09 is theTAB character, 0x22 is the double quote " character.) so "C:\Program Files\" becomes ^0x22C:\Program^ Files\^0x22 Internal CMD.exe commands must be preceded with "cmd /c". If ForFiles finds one or more matches if will return %errorlevel% =0 If ForFiles finds no matches if will return %errorlevel% =1 and will print "ERROR: No files found with the specified search criteria." Very early versions of ForFiles use unix style -parameters, can only match dates newer than a specified date and use the following command variables names: (which must be upper case) @FILE, @FNAME_WITHOUT_EXT, @EXT, @PATH, @RELPATH, @ISDIR, @FSIZE, @FDATE, @FTIME Examples: Print a warning if the testfile is 5 days old or older: C:\> forfiles /m testfile.txt /c "cmd /c echo file is too old" /d -5 Delete the testfile if it is is 5 days old or older: C:\> forfiles /m testfile.txt /c "cmd /c Del testfile.txt " /d -5 Find .xls file that were last modified 30 days ago or longer C:\> FORFILES /M *.xls /C "cmd /c echo @path was changed 30 days ago" /D -30 List the size of all .doc files: C:\> FORFILES /S /M *.doc /C "cmd /c echo @fsize" An alternative method of dealing with files older or newer than a specified date is to use ROBOCOPY Rule #1: Don't sweat the small stuff. Rule #2: It's all small stuff - Dr Robert S Eliot, University of Nebraska cardiologist |
68). FORMAT = Format a disk... |
---|
(EXPLAIN - FORMAT.com) Format a disk for use with Windows. Syntax FORMAT drive: [/FS:file-system] [/V:label] [/Q] [size] [/C] Key /FS:file-system The file system (FAT or NTFS). The NTFS file system does not function on floppy disks. /V:label The volume label. /Q Quick format. /C Compression - files added to the new disk will be compressed. [size] may be defined either with /F:size or /A:size /F:size size is the size of the floppy disk (720, 1.2, 1.44, 2.88, or 20.8). /A:size Allocation unit size. Default settings (via /F) are strongly recommended for general use. NTFS supports 512, 1024, 2048, 4096, 8192, 16K, 32K, 64K. FAT supports 8192, 16K, 32K, 64K, 128K, 256K. NTFS compression is not supported for allocation units above 4096. Example @echo off Echo Warning this will reformat the entire D: disk! PAUSE format D: /FS:NTFS /x "The disks had a recording density of 1,100 bits per inch, and could move data out of the drive at 77 kilobytes per second" - Early hard drive specs. |
69). FSUTIL = File and Volume utilities... |
---|
(EXPLAIN - FSUTIL.exe) File and Volume specific commands, Hardlink management, Quota management, USN, Sparse file, Object ID and Reparse point management Create a hardlink FSUTIL hardlink create new_filename existing_filename Eg : fsutil hardlink create c:\foo.txt c:\bar.txt Create a new file of a specific size FSUTIL file createnew filename Eg : fsutil file createnew C:\testfile.txt 1000 Set the short NTFS filename for a file FSUTIL file setshortname filename shortname Eg : fsutil file setshortname C:\testfile.txt tes1.txt Set the valid data length for a file FSUTIL file setvaliddata filename datalength Eg : fsutil file setvaliddata C:\testfile.txt 4096 Set the zero data for a file FSUTIL file setzerodata offset=val length=val filename offset : File offset, the start of the range to set to zeroes length : Byte length of the zeroed range Eg : fsutil file setzerodata offset=100 length=150 C:\Temp\sample.txt List all drives (including mapped and Subst drives) FSUTIL fsinfo drives Query drive type for a drive FSUTIL fsinfo drivetype volume pathname Eg : fsutil fsinfo drivetype C: ListLocalDrives.cmd - List all drives on the local computer Query volume information FSUTIL fsinfo volumeinfo volume pathname Eg : fsutil fsinfo volumeinfo C:\ Query NTFS specific volume information FSUTIL fsinfo ntfsinfo volume pathname Eg : fsutil fsinfo ntfsinfo C: Query file system statistics FSUTIL fsinfo statistics volume pathname Eg : fsutil fsinfo statistics C: QUOTA Management FSUTIL quota {query|disable|track|enforce } C: FSUTIL quota violations FSUTIL quota modify volume_pathname threshold limit user Eg : fsutil quota modify c: 3000 5000 domain\user Find a file by user name (if Disk Quotas are enabled) FSUTIL file findbysid user directory Eg : fsutil file findbysid scottb C:\users File system options: FSUTIL behavior query option FSUTIL behavior set option Where option is one of: allowextchar {0|1} Allow extended characters in filenames disablelastaccess {0|1} Don't generate last-access times quotanotify NumSeconds Log quota violations, default=3600 seconds mftzone {1|2|3|4} Set MFT Zone, multiple of 200MB Bugcheckoncorrupt {0|1} Enable bugcheck # disablecompression {0|1} Disable compression # disableencryption {0|1} Disable encryption # encryppagingfile {0|1} memoryusage {1|2} Paged-pool memory cache, 1=default # symlinkevaluation L2L:{0|1} Local to local symbolic links # symlinkevaluation L2R:{0|1} Local to remote symbolic links # symlinkevaluation R2R:{0|1} Remote to local symbolic links # symlinkevaluation R2L:{0|1} Remote to remote symbolic links # DisableDeleteNotify {0|1} Delete notifications for all volumes# disable8dot3 [volumePath] sfnNum sfnNum is between 0 and 3 0 = Create short file names (default). 1 = Don't create short file names. 2 = Set 8.3 names on a per volume basis. 3 = Disable 8.3 names on all volumes except the system volume. 1 = enable option 0 = Disable option # = Windows7/2008 option Eg : FSUTIL behavior query disable8dot3 FSUTIL behavior set disablelastaccess 1 FSUTIL dirty query volume pathname FSUTIL dirty set volume pathname Marking a disk as dirty will prompt a Chkdsk at next boot Eg : FSUTIL dirty query C: Query a reparse point FSUTIL reparsepoint query filename Eg : fsutil reparsepoint query C:\Server Delete a reparse point FSUTIL reparsepoint delete filename Eg : fsutil reparsepoint delete C:\Server Edit an object identifier FSUTIL objectid {query | set | delete | create} Set sparse file properties FSUTIL sparse queryflag filename FSUTIL sparse setflag filename FSUTIL sparse queryrange filename FSUTIL sparse setrange filename Eg : fsutil sparse queryflag "C:\My Test.txt" Query the allocated ranges for a file FSUTIL file queryallocranges offset=val length=val filename offset : File Offset, the start of the range to query length : Size, in bytes, of the range Eg : fsutil file queryallocranges offset=1024 length=64 C:\Temp\sample.txt To run FSUTIL, you must be logged on as an administrator or a member of the Administrators group. Sparse files provide a method of saving disk space for files that contain meaningful data as well as large sections of data composed of zeros. If an NTFS file is marked as sparse, then disk clusters are allocated only for the data explicitly specified by the application. e.g. The Indexing Service, stores it's catalogs as sparse files. With 8.3 filennames disabled you'll notice a performance improvement only with a large number of files (over 300,000) in relatively few folders where a lot of the filenames start with similar names. Not having 8.3 filenames available will prevent the use of old applications such as Word 2.0 and Excel 4.0 If you have a lot of small files, you may need a larger Master File Table to avoid MFT fragmentation: FSUTIL behavior set mftzone 2 will reserve 25 % of the volume for the MFT. 1 = 12.5 %(default) 2 = 25% 3 = 37.5% 4 = 50% This won't affect existing disk partitions, after changing the mftzone size, reboot the machine and create a new partition. In Windows7 and Server 2008 the mft zone is allocated in blocks of 200MB: 1 = 200 MB (default) 2 = 400 MB 3 = 600 MB 4 = 800 MB Increasing the MFT zone does not decrease the disk space available for data files. The last access time attribute of NTFS can slow performance, if you disable it, the time set will simply be the Creation Time. FSUTIL behavior set disablelastaccess 1 Bugs FSUTIL outputs a NULL character (not a space) after every drive specifier, this may cause difficulty when piping the output of fsutil into other commands (particularly FOR), see this forum thread for more detail. Some features in fsutil are reported to not work correctly under FAT or FAT32 volumes e.g. FSUTIL dirty query. |
70). FTP = File Transfer Protocol... |
---|
(EXPLAIN - FTP) File Transfer Protocol Syntax FTP [-options] [-s:filename] [-w:buffer] [host] key -s:filename Run a text file containing FTP commands. host Host name or IP address of the remote host. -g Disable filename wildcards. -n No auto-login. -i No interactive prompts during ftp. -v Hide remote server responses. -w:buffer Set buffer size to buffer (default=4096) -d Debug -a Use any local interface when binding data connection. Commands to run at the FTP: prompt append local-file [remote-file] Append a local file to a file on the remote computer. ascii Set the file transfer type to ASCII, the default. In ASCII text mode, character-set and end-of-line characters are converted as necessary. bell Toggle a bell to ring after each command. By default, the bell is off. binary Set the file transfer type to binary. Use `Binary' for transferring executable program files or binary data files e.g. Oracle bye End the FTP session and exit ftp cd Change the working directory on the remote host. close End the FTP session and return to the cmd prompt. debug Toggle debugging. When debug is on, FTP will display every command. delete remote-file Delete file on remote host. dir [remote-directory] [local-file] List a remote directory's files and subdirectories. (or save the listing to local-file) disconnect Disconnect from the remote host, retaining the ftp prompt. get remote-file [local-file] Copy a remote file to the local PC. glob Toggle the use of wildcard characters in local pathnames. By default, globbing is on. hash Toggle printing a hash (#) for each 2K data block transferred. By default, hash mark printing is off. help [command] Display help for ftp command. lcd [directory] Change the working directory on the local PC. By default, the working directory is the directory in which ftp was started. literal argument [ ...] Send arguments, as-is, to the remote FTP host. ls [remote-directory] [local-file] List a remote directory's files and folders. (short format) mdelete remote-files [ ...] Delete files on remote host. mdir remote-files [ ...] local-file Display a list of a remote directory's files and subdirectories. (or save the listing to local-file) Mdir allows you to specify multiple files. mget remote-files [ ...] Copy multiple remote files to the local PC. mkdir directory Create a directory on the remote host. mls remote-files [ ...] local-file List a remote directory's files and folders. (short format) mput local-files [ ...] Copy multiple local files to the remote host. open computer [port] Connects to the specified FTP server. prompt Toggle prompting. Ftp prompts during multiple file transfers to allow you to selectively retrieve or store files; mget and mput transfer all files if prompting is turned off. By default, prompting is on. put local-file [remote-file] Copy a local file to the remote host. pwd Print Working Directory (current directory on the remote host) quit End the FTP session with the remote host and exit ftp. quote argument [ ...] Send arguments, as-is, to the remote FTP host. recv remote-file [local-file] Copy a remote file to the local PC. remotehelp [command] Display help for remote commands. rename filename newfilename Rename remote files. rmdir directory Delete a remote directory. send local-file [remote-file] Copy a local file to the remote host. status Display the current status of FTP connections and toggles. trace Toggles packet tracing; trace displays the route of each packet type [type-name] Set or display the file transfer type: `binary' or `ASCII' (the default) If type-name is not specified, the current type is displayed. ASCII should be used when transferring text files. In ASCII text mode, character-set and end-of-line characters are converted as necessary. Use `Binary' for transferring executable files. user user-name [password] [account] Specifes a user to the remote host. verbose Toggle verbose mode. By default, verbose is on. ! command Run command on the local PC. ? [command] Display help for ftp command. Examples an example FTP Script to retrieve files in binary and then ascii mode: ::GetFiles.ftp [User_id] [ftp_password] binary get /usr/file1.exe get file2.html mget *.jpeg ascii mget *.txt quit To run the above script: FTP -s:GetFiles.ftp [hostname] This will connect as the user:User_id with password:ftp_password An FTP Script to publish files in binary mode: ::PutFiles.ftp [User_id] [ftp_password] binary mput *.html cd images mput *.gif quit To run the above script: FTP -s:PutFiles.ftp [hostname] This will connect as the user:User_id with password:ftp_password Using the Windows GUI for FTP Windows Explorer (not Internet Explorer) also has a built in FTP client. Type in the address bar: ftp://username@ftpserver.address.com you will be prompted for the password. You can also do ftp://username:password@ftpserver.address.com This is not recommended as anyone can read the password. Secure FTP Standard FTP does not encrypt passwords - they are sent across the network in plain text. A more secure method is to use SecureFTP (SFTP) or SecureCopy (SCP) Freeware clients are available e.g. WinSCP |
71). FTYPE = Display or modify file types used in file extension associations... |
---|
(EXPLAIN - FTYPE) Display or change the link between a FileType and an executable program Syntax FTYPE fileType=executable_path FTYPE FTYPE fileType FTYPE fileType= Key fileType : The type of file executable_path : The executable program including any command line parameters More than one file extension may be associated with the same File Type. e.g. both the extension .JPG and the extension .JPEG may be associated with the File Type "jpegfile" File Types can be displayed in the Windows Explorer GUI under Options, File Types however the naming used is not consistent e.g. the File Type "txtfile" is displayed in the GUI as "Text Document"and "jpegfile" is displayed as "image/jpeg" Several FileTypes can be linked to the same executable application. FTYPE filetype will display the current executable program for that file type e.g. FTYPE jpegfile. FTYPE without any parameters will display all FileTypes and the executable program for each. Defining command line parameters It is almost always necessary to supply command line parameters so that when a document is opened not only is the relevant application loaded into memory but the document itself also loaded into the application. To make this happen the filename of the document must be passed back to the application. Command line parameters are exactly like batch file parameters, %0 is the executable program and %1 will reference the document filename so a simple command line might be: MyApplication.exe "%1" If any further parameters are required by the application they can be passed as %2, %3. To pass ALL parameters to an application use %*. To pass all the remaining parameters starting with the nth parameter, use %~n where n is between 2 and 9. The FileType should always be created before making a File Association For example: FTYPE htmlfile="C:\PROGRA~1\Plus!\MICROS~1\iexplore.exe" -nohome ASSOC .html=htmlfile FTYPE pagemill.html=C:\PROGRA~1\Adobe\PAGEMI~1.0\PageMill.exe "%1" ASSOC .html=pagemill.html FTYPE rtffile="C:\Program Files\Windows NT\Accessories\WORDPAD.EXE" "%1" ASSOC .rtf=rtffile FTYPE word.rtf.8="C:\Program Files\Microsoft Office\Office\winword.exe" /n ASSOC .rtf=word.rtf.8 Switching a File Association between multiple applications If you have multiple applications that use the same file extension, the ASSOC command can be used to switch the file extension between the different FileTypes. Deleting a FileType Specify executable_path=nothing and the FTYPE command will delete the executable_path for that FileType. For example: FTYPE htmlfile= Backup your FileTypes FTYPE >backup_types.txt ASSOC >backup_ext.txt Restore your FileTypes from a Backup FOR /F "tokens=* delims=" %G IN (backup_types.txt) DO FTYPE %G FOR /F "tokens=* delims=" %G IN (backup_ext.txt) DO ASSOC %G This will recreate the CLASS id's in the registry at HKey_Classes_Root\. If you put the commands above in a batch file change the %G to be %%G Using File associations at the command line If you have a file association between .DOC and Word for Windows then at a command prompt you can open a document with any of the following commands: Start "My Document.doc" "Monthly Report.doc" JULY.DOC note that the file extension must be supplied for this to work |
72). GLOBAL = Display membership of global groups... |
---|
(EXPLAIN - GLOBAL) Display membership of global groups on remote servers or remote domains. Syntax GLOBAL group_name domain_name | \\server Key group_name The global group. domain_name A network domain. \\server A network server. Examples: GLOBAL "Domain Users" Scotland Displays the members of the group "Domain Users" in the Scotland domain. GLOBAL PrintUsers \\9G_Server Displays the members of the group PrintUsers on server 9G_Server. |
73). GOTO = Direct a batch program to jump to a labelled line... |
---|
(EXPLAIN - GOTO) Direct a batch program to jump to a labelled line. Syntax GOTO label Key label : a predefined label in the batch program. Each label must be on a line by itself, beginning with a colon. To exit a batch script file or exit a subroutine specify GOTO:eof this will transfer control to the end of the current batch file, or the end of the current subroutine. Examples: IF %1==12 GOTO MySubroutine Echo the input was NOT 12 goto:eof :MySubroutine Echo the input was 12 goto:eof Use a variable as a label CHOICE /C:01 /m choose [Y]yes or [N]No goto s_routine_%ERRORLEVEL% :s_routine_0 Echo You typed Y for yes goto:eof :s_routine_1 Echo You typed N for no goto:eof Skip commands by using a variable as a :: comment (REM) In this example the COPY command will only run if the parameter "Update" is supplied to the batch @echo off setlocal IF /I NOT %1==Update SET _skip=:: %_skip% COPY x:\update.dat %_skip% echo Update applied ... If Command Extensions are disabled GOTO will no longer recognise the :EOF label "GOTO... how bad can it be??..." - XKCD |
74). GPUPDATE = Update Group Policy settings... |
---|
(EXPLAIN - GPUPDATE.exe) Update Group Policy settings. Syntax GPUpdate [/Force] [/Logoff] [/Boot] [/Sync] [/Target:{Computer | User}] [/Wait:value] Key: /Force Apply all policy settings, not just those that have changed. /Logoff Logoff after the Group Policy settings have been updated. Some group policy client-side extensions are only processed when a user logs on. (Software Install, Folder Redirection.) /Boot Restart after the Group Policy settings are applied. Some group policy client-side extensions are only processed at startup (e.g. computer-targeted Software Install) /Sync Apply the next foreground policy synchronously (in the background). This can be applied to computer boot and/or user logon. (see /Target) /Target: Update only User or only Computer policy settings default = both /Wait: The number of seconds to wait for policy processing. default = 600 (10 minutes) '0' = do not wait. '-1' = wait indefinitely. If the time limit is exceeded, the command prompt returns, but policy processing continues. /Logoff and /Boot will have no effect if there are no client-side extensions called that require a logoff/reboot. /Force and /Wait parameters will be ignored if /sync is specified. GPUPDATE will apply new and changed policies, it will not remove an existing setting where the policy is set to "not configured" Example C:\> GPUpdate /Force |
75). HELP = Online Help... |
---|
(EXPLAIN - HELP) Online help for MS Windows - most commands will give help when run with /? or -? (COMMAND /? or COMMAND -?) GUI Help is available from START - Help or by running the help files directly: C:\WINDOWS\help\ntcmds.chm C:\WINDOWS\help\ntdef.chm C:\WINDOWS\help\ntchowto.chm C:\WINDOWS\help\nthelp.chm C:\WINDOWS\help\ntshared.chm Syntax WINHELP [options] helpfile.hlp WINHLP32.exe [options] helpFile In XP: C:\WINDOWS\PCHealth\HelpCtr\Binaries\HelpCtr.exe options: -H show help about help -G[n] Build a .gid file and quit, If a number is specified, it determines which extensible tab to display by default the first time the help file is opened. A value of 1 would be the first tab beyond the Find tab. This command cannot be used with -S. -S Create a .gid file without showing an animated icon. Cannot be used with -G. (winhlp32 only) -W window Specify the window for displaying the topic. This command cannot be used with -P. -P Show the topic in a pop-up window. This command cannot be used with -W. You must use the -P switch in combination with the -N (context number) or -I (topic ID) switch. -N contextNum | -I topicID Specify the topic to open using either a topic number, (defined in the [MAP] section of the HPJ file.) or a topic ID string (# footnote in the topic). -K keyword Specify the topic to open using a keyword. This command cannot be used with -N or -I. |
76). iCACLS = Change file and folder permissions... |
---|
(EXPLAIN - iCACLS.exe (2003 sp2, Vista). Change file and folder permissions - display or modify Access Control Lists (ACLs) for files and folders. iCACLS resolves various issues that occur when using the older CACLS & XCACLS Syntax (files) ICACLS FileName [/grant[:r] User:Permission[...]] [/deny User:Permission[...]] [/remove[:g|:d]] User[...]] [/t] [/c] [/l] [/q] [/setintegritylevel Level[...]] Syntax (Store acls for all matching names into aclfile for later use with /restore) ICACLS name /save aclfile [/T] [/C] [/L] [/Q] Syntax (restore folder) ICACLS directory [/substitute SidOld SidNew [...]] /restore aclfile [/C] [/L] [/Q] Syntax (Change Owner) ICACLS name /setowner user [/T] [/C] [/L] [/Q] Syntax (Find items with an ACL that mentions a specific SID) ICACLS name /findsid Sid [/T] [/C] [/L] [/Q] Syntax (Find files whose ACL is not in canonical form or with a length inconsistent with the ACE count.) ICACLS name /verify [/T] [/C] [/L] [/Q] Syntax (Replace ACL with default inherited acls for all matching files) ICACLS name /reset [/T] [/C] [/L] [/Q] Key /T Traverse all subfolders to match files/directories. /C Continue on file errors (access denied) Error messages are still displayed. /L Perform the operation on a symbolic link itself, not its target. /Q Quiet - supress success messages. /grant :r user:permission Grant access rights, with :r, the permissions will replace any previouly granted explicit permissions. Otherwise the permissions are added. /deny user:permission Explicitly deny the specified user access rights. This will also remove any explicit grant of the same permissions to the same user. /remove[:[g|d]] User Remove all occurrences of User from the acl. :g remove all granted rights to that User/Sid. :d remove all denied rights to that User/Sid. /setintegritylevel [(CI)(OI)]Level Add an integrity ACE to all matching files. level is one of L,M,H (Low Medium or High) A Directory Inheritance option for the integrity ACE may precede the level: /inheritance:e|d|r e - enable inheritance d - disable inheritance and copy the ACEs r - remove all inherited ACEs user A user account, Group or a SID /restore Apply the acls stored in ACLfile to the files in directory permission is a permission mask and can be specified in one of two forms: a sequence of simple rights: F - full access M - modify access RX - read and execute access R - read-only access W - write-only access a comma-separated list in parenthesis of specific rights: D - delete RC - read control WDAC - write DAC WO - write owner S - synchronize AS - access system security MA - maximum allowed GR - generic read GW - generic write GE - generic execute GA - generic all RD - read data/list directory WD - write data/add file AD - append data/add subdirectory REA - read extended attributes WEA - write extended attributes X - execute/traverse DC - delete child RA - read attributes WA - write attributes inheritance rights may precede either form and are applied only to directories: (OI) - object inherit (CI) - container inherit (IO) - inherit only (NP) - don't propagate inherit Unlike many other command-line tools, iCACLS correctly preserves the canonical ordering of ACE entries: Explicit denials Explicit grants Inherited denials Inherited grants Access Control Lists apply only to files stored on an NTFS formatted drive, each ACL determines which users (or groups of users) can read or edit the file. When a new file is created it normally inherits ACL's from the folder where it was created. Using iCACLS To edit a file you must already have the "Change" ACL (or be the file's owner) To use the iCACLS command to change the permissions of a file requires "FULL Control" (or be the file's owner) File "Ownership" will always override all ACL's - you always have Full Control over files that you create. Inherited folder permissions are displayed as: OI - Object inherit - This folder and files. (no inheritance to subfolders) CI - Container inherit - This folder and subfolders. IO - Inherit only - The ACE does not apply to the current file/directory These can also be combined as folllows: (OI)(CI) This folder, subfolders, and files. (OI)(CI)(IO) Subfolders and files only. (CI)(IO) Subfolders only. (OI) (IO) Files only. So BUILTIN\Administrators:(OI)(CI)F means that both files and Subdirectories will inherit 'F' (Fullcontrol) similarly (CI)R means Directories will inherit 'R' (Read folders only = List permission) When cacls is applied to the current folder only there is no inheritance and so no output. Bugs You can’t break existing inheritance of permissions with icacls, for that you need XCACLS.vbs. In Windows Server 2003 SP2 there is a bug when attempting to use the /setowner switch, which returns “Access denied”. A limited release hotfix is available to resolve this issue (Q947870) alternatively use SUBINACL nb this bug is NOT present on Vista SP1 or Windows Server 2008. Examples: To backup the ACLs of every file in a directory type: icacls * /save Myacl_backup.txt Restore ACLS using a previously saved acl file: icacls /restore Myacl_backup.txt Change the Integrity Level (IL) of a file to High: icacls MyReport.doc /setintegritylevel H Grant the group FileAdmins Delete and Write DAC permissions to Sales_Folder: icacls Sales_Folder /grant FileAdmins:(D,WDAC) Propagate a new permission to all files and subfolders, without using inheritance: (so if any of the subfolders contain specific permissions, those won't be overwritten) icacls * /grant accountName:(NP)(RX) /T |
77). IF = Conditionally perform a command... |
---|
(EXPLAIN - IF) Conditionally perform a command. File syntax IF [NOT] EXIST filename command IF [NOT] EXIST filename (command) ELSE (command) String syntax IF [/I] [NOT] item1==item2 command IF [/I] item1 compare-op item2 command IF [/I] item1 compare-op item2 (command) ELSE (command) Error Check Syntax IF [NOT] DEFINED variable command IF [NOT] ERRORLEVEL number command IF CMDEXTVERSION number command key item May be a text string or an environment variable a variable may be modified using either Substring syntax or Search syntax command The command to perform NOT perform the command if the condition is false. == perform the command if the two strings are equal. /I Do a case Insensitive string comparison. compare-op May be one of EQU : Equal NEQ : Not equal LSS : Less than < LEQ : Less than or Equal <= GTR : Greater than > GEQ : Greater than or equal >= This 3 digit syntax is necessary because the > and < symbols are recognised as redirection operators IF ERRORLEVEL n statements should be read as IF Errorlevel >= number i.e. IF ERRORLEVEL 0 will return TRUE when the errorlevel is 64 An alternative and often better method of checking Errorlevels is to use the string syntax along with the %ERRORLEVEL% variable: IF %ERRORLEVEL% GTR 0 Echo An error was found IF %ERRORLEVEL% LSS 0 Echo An error was found IF %ERRORLEVEL% EQU 0 Echo No error found IF %ERRORLEVEL% EQU 0 (Echo No error found) ELSE (Echo An error was found) IF %ERRORLEVEL% EQU 0 Echo No error found || Echo An error was found Note some errors are negative numbers. When working with errorlevels in a batch file it's a good idea to also use SETLOCAL so that the %ERRORLEVEL% variable is reset each time the batch file runs. IF EXIST filename will return true if the file exists (this is not case sensitive). Examples: IF EXIST C:\install.log (echo complete) ELSE (echo failed) IF DEFINED _department ECHO Got the department variable IF DEFINED _commission SET /A _salary=%_salary% + %_commission% IF CMDEXTVERSION 1 GOTO start_process IF %ERRORLEVEL% EQU 2 goto sub_problem2 Does %1 exist? To test for the existence of a command line parameter - use empty brackets like this IF [%1]==[] ECHO Value Missing or IF [%1] EQU [] ECHO Value Missing In the case of a variable that may be NULL - a null variable will remove the variable definition altogether, so testing for NULLs becomes easy: IF NOT DEFINED _example ECHO Value Missing IF DEFINED will return true if the variable contains any value (even if the value is just a space) Test the existence of files and folders IF EXIST name - will detect the existence of a file or a folder - the script empty.cmd will show if the folder is empty or not. Brackets You can improve the readability of a batch script by writing a complex IF...ELSE command over several lines using brackets e.g. IF EXIST filename ( del filename ) ELSE ( echo The file was not found. ) The IF statement does not use any great intelligence when evaluating Brackets, so for example the command below will fail: IF EXIST MyFile.txt (ECHO Some(more)Potatoes) This version will work: IF EXIST MyFile.txt (ECHO Some[more]Potatoes) If the string being compared by an IF command includes delimiters such as [Space] or [Comma], then either the delimiters must be escaped with a caret ^ or the whole string must be "quoted". This is so that the IF statement will treat the string as a single item and not as several separate strings. Testing Numeric values Do not use brackets or quotes when comparing numeric values e.g. IF (2) GEQ (15) echo "bigger" or IF "2" GEQ "15" echo "bigger" These will perform a character comparison and will always echo "bigger" however the command IF 2 GEQ 15 echo "bigger" Will perform a numeric comparison and works as expected - notice that this behaviour is exactly opposite to the SET /a command where quotes are required. The examples here all use GEQ, but this applies equally to all the compare-op operators: EQU, NEQ, LSS, LEQ, GTR, GEQ when comparing numbers as a string "026" > "26" Wildcards Wildcards are not supported by IF, so %COMPUTERNAME%==SS6* will not match SS64 A workaround is to retrieve the substring and compare just those characters: SET _prefix=%COMPUTERNAME:~0,3% IF %_prefix%==SS6 GOTO they_matched Pipes When piping commands, the expression is evaluated from left to right, so IF... | ... is equivalent to (IF ... ) | ... you can also use the explicit syntax IF (... | ...) ERRORLEVEL To deliberately raise an ERRORLEVEL in a batch script use the EXIT /B command. It is possible (though not a good idea) to create a string variable called %ERRORLEVEL% (user variable) if present such a variable will prevent the real ERRORLEVEL (a system variable) from being used by commands such as ECHO and IF. To test for the existence of a user variable use SET errorlevel, or IF DEFINED ERRORLEVEL If Command Extensions are disabled IF will only support direct comparisons: IF ==, IF EXIST, IF ERRORLEVEL also the system variable CMDEXTVERSION will be disabled. |
78). IFMEMBER = Is the current user in an NT Workgroup... |
---|
(EXPLAIN - IFMEMBER) Find out if the current user is a member of one or more workgroups. Syntax IFMEMBER [options] WorkGroup [ WorkGroup2 WorkGroup3...] Options: /verbose or /v : print all matches. /list or /l : print all groups user is a member of The %ERRORLEVEL% return code shows how many of the listed workgroups the currently logged-in user is a member of. Examples IFMEMBER /v /l "MyDomain\Administrators" IF ERRORLEVEL 1 echo This user is an Administrator Notice that the syntax here is the opposite to most other commands in that an %errorlevel% of 1 = Success A good way to utilise IFMEMBER is through conditional execution... IFMEMBER Administrators || ECHO Error is 1 so [%Username%] is in Admin_WG IFMEMBER Administrators && ECHO Error is 0 so [%Username%] is NOT in Admin_WG |
79). IPCONFIG = Configure IP... |
---|
(EXPLAIN - IPCONFIG) Configure IP (internet protocol configuration) Syntax IPCONFIG /all Display full configuration information. IPCONFIG /release [adapter] Release the IP address for the specified adapter. IPCONFIG /renew [adapter] Renew the IP address for the specified adapter. IPCONFIG /flushdns Purge the DNS Resolver cache. IPCONFIG /registerdns Refresh all DHCP leases and re-register DNS names. IPCONFIG /displaydns Display the contents of the DNS Resolver Cache. IPCONFIG /showclassid adapter Display all the DHCP class IDs allowed for adapter. IPCONFIG /setclassid adapter [classid] Modify the dhcp class id. If the Adapter name contains spaces, use quotes: "Adapter Name" wildcard characters * and ? allowed, see the examples below The default is to display only the IP address, subnet mask and default gateway for each adapter bound to TCP/IP. For Release and Renew, if no adapter name is specified, then the IP address leases for all adapters bound to TCP/IP will be released or renewed. For Setclassid, if no ClassId is specified, then the ClassId is removed. Examples: > ipconfig ... Show information. > ipconfig /all ... Show detailed information > ipconfig /renew ... renew all adapters > ipconfig /renew EL* ... renew any connection that has its name starting with EL > ipconfig /release *Con* ... release all matching connections, eg. "Local Area Connection 1" or "Local Area Connection 2" > ipconfig /setclassid "Local Area Connection" TEST ... set the DHCP class ID for the named adapter to = TEST |
80). KILL = Remove a program from memory... |
---|
(EXPLAIN - KILL) Remove a running process from memory. Syntax KILL [option] process_id KILL [option] task_name KILL [option] window_title Option -f Force process kill Note: Kill -f basically just nukes the process from existence, potentially leaking a lot of memory and losing any data that the process hadn't committed to disk yet. It is there for worst case scenarios - when you absolutely must end the process now, and don't care whether proper cleanup gets done or not. In WindowsXP, KILL is replaced with the superior TASKKILL - Allowing you to specify a remote computer, different user account etc - for more details run TASKKILL /? |
No comments:
Post a Comment