Windows Tools: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
m Bot: Replace deprecated source tag with syntaxhighlight
mNo edit summary
 
Line 7: Line 7:
Except for its obvious purpose, the '''copy''' utility is also useful for concatenating files; this can come in handy when producing disk images, for instance. To illustrate the point, suppose we wanted to produce a file called ''foobar'' from files ''foo'' and ''bar''; we would use the following command:
Except for its obvious purpose, the '''copy''' utility is also useful for concatenating files; this can come in handy when producing disk images, for instance. To illustrate the point, suppose we wanted to produce a file called ''foobar'' from files ''foo'' and ''bar''; we would use the following command:


<syntaxhighlight lang="dos">copy /b foo+bar foobar</syntaxhighlight>
<syntaxhighlight lang="bat">copy /b foo+bar foobar</syntaxhighlight>


The '''/b''' switch indicates that we are dealing with binary files instead of ASCII. We need to specify it as this is behavior is not default when combining files.
The '''/b''' switch indicates that we are dealing with binary files instead of ASCII. We need to specify it as this is behavior is not default when combining files.
Line 40: Line 40:
DOS users will remember '''diskcopy''', which replicates volumes. It only works with removable media such as memory cards, and floppy disks. The media must be of the same type for the operation to work. E.g., if we had two floppy drives A:, and B:, we could copy A:'s image to B: as such:
DOS users will remember '''diskcopy''', which replicates volumes. It only works with removable media such as memory cards, and floppy disks. The media must be of the same type for the operation to work. E.g., if we had two floppy drives A:, and B:, we could copy A:'s image to B: as such:


<syntaxhighlight lang="dos">diskcopy A: B:</syntaxhighlight>
<syntaxhighlight lang="bat">diskcopy A: B:</syntaxhighlight>


* If the destination drive is not specified, the current one will be used. In addition, the '''/v''' argument can be used for verification (remember, floppy disks are not exactly reliable).
* If the destination drive is not specified, the current one will be used. In addition, the '''/v''' argument can be used for verification (remember, floppy disks are not exactly reliable).
Line 89: Line 89:
| rowspan="2" | 8dot3name
| rowspan="2" | 8dot3name
| query || This can be used in order to find out whether a volume (which may very well be a loopback device) is configured to use the 8.3 file naming scheme. Example:
| query || This can be used in order to find out whether a volume (which may very well be a loopback device) is configured to use the 8.3 file naming scheme. Example:
<syntaxhighlight lang="dos">fsutil 8dot3name query C:</syntaxhighlight>
<syntaxhighlight lang="bat">fsutil 8dot3name query C:</syntaxhighlight>
If no volume is specified, information on all volumes is displayed.
If no volume is specified, information on all volumes is displayed.
|-
|-
| set || This option can set one or all volumes to (not) use the 8.3 file name scheme. Before this can be used on a per volume basis, the registry key '''HKLM\System\CurrentControlSet\Control\FileSystem\NtfsDisable8dot3NameCreationNtfsDisable8dot3NameCreationNtfsDisable8dot3NameCreation''' must be set to the value 2, if this is not already true. This can be done by using the following command:
| set || This option can set one or all volumes to (not) use the 8.3 file name scheme. Before this can be used on a per volume basis, the registry key '''HKLM\System\CurrentControlSet\Control\FileSystem\NtfsDisable8dot3NameCreationNtfsDisable8dot3NameCreationNtfsDisable8dot3NameCreation''' must be set to the value 2, if this is not already true. This can be done by using the following command:
<syntaxhighlight lang="dos">fsutil 8dot3name set 2</syntaxhighlight>
<syntaxhighlight lang="bat">fsutil 8dot3name set 2</syntaxhighlight>
Next, we are free to play around with individual volumes:
Next, we are free to play around with individual volumes:
<syntaxhighlight lang="dos">fsutil 8dot3name set C: 0</syntaxhighlight>
<syntaxhighlight lang="bat">fsutil 8dot3name set C: 0</syntaxhighlight>
The last parameter can take the value 0 (enable) or 1 (disable). This is somewhat odd; the reason behind it is probably that Microsoft, in order to avoid confusion, decided to preserve these values, which are also used in a similar command.
The last parameter can take the value 0 (enable) or 1 (disable). This is somewhat odd; the reason behind it is probably that Microsoft, in order to avoid confusion, decided to preserve these values, which are also used in a similar command.
|-
|-
| rowspan="4" | file
| rowspan="4" | file
| createnew || Creates an empty file (all zeroes) of some size specified, in bytes. Example:
| createnew || Creates an empty file (all zeroes) of some size specified, in bytes. Example:
<syntaxhighlight lang="dos">fsutil createnew foobar 42</syntaxhighlight>
<syntaxhighlight lang="bat">fsutil createnew foobar 42</syntaxhighlight>
|-
|-
| setshortname || Sets the 8.3 name for a file (while preserving its long name). Example:
| setshortname || Sets the 8.3 name for a file (while preserving its long name). Example:
<syntaxhighlight lang="dos">fsutil setshortname foobarbaz fooba~1</syntaxhighlight>
<syntaxhighlight lang="bat">fsutil setshortname foobarbaz fooba~1</syntaxhighlight>
|-
|-
| setvaliddata || Sets the VDL for a file. Example:
| setvaliddata || Sets the VDL for a file. Example:
<syntaxhighlight lang="dos">fsutil setvaliddata foobar 4096</syntaxhighlight>
<syntaxhighlight lang="bat">fsutil setvaliddata foobar 4096</syntaxhighlight>
|-
|-
| setzerodata || Sets one or more bytes in a file to zero. Example:
| setzerodata || Sets one or more bytes in a file to zero. Example:
<syntaxhighlight lang="dos">fsutil setzerodata foobar offset=42 length=42 foobar</syntaxhighlight>
<syntaxhighlight lang="bat">fsutil setzerodata foobar offset=42 length=42 foobar</syntaxhighlight>
|}
|}