Shrink


Applies To: Windows Vista,Windows 7,Windows Server 2008 R2,Windows Server 2008

Reduces the size of the selected volume by the amount you specify. This parameter makes free disk space available from the unused space at the end of the volume.

For examples of how this command can be used, see Examples.

Syntax


Copy Code

shrink [desired=<n>] [minimum=<n>] [nowait] [noerr]
shrink querymax [noerr]

Parameters

Parameter

Description

desired=<n>

Specifies the desired amount of space in megabytes (MB) to reduce the size of the volume by. If a desired amount is not specified, the volume will be reduced by the maximum amount of free space available on the volume.

minimum=<n>

Specifies the minimum amount of space in MB to reduce the size of the volume by.

querymax

Returns the maximum amount of space in MB by which the volume can be reduced (that is, the free space available on the volume). This value may change if applications are currently accessing the volume.

nowait

Forces the command to return immediately while the shrink process is still in progress.

noerr

For scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without this parameter, an error causes DiskPart to exit with an error code.

Remarks

Examples

To reduce the size of the selected volume by the largest possible amount between 250 and 500 megabytes, type:


Copy Code

shrink desired=500 minimum=250

To display the maximum number of MB that the volume can be reduced by, type:


Copy Code

shrink querymax

Additional references

Command-Line Syntax Key

DiskPart