Sie sind auf Seite 1von 4

DiskPart

22 out of 32 rated this helpful


Updated: April 17, 2012
Applies To: Windows 7, Windows Server 2008, Windows
Server 2008 R2, Windows Vista
DiskPart is a text-mode command interpreter that enables
you to manage objects (disks, partitions, volumes, or virtual
hard disks) by using scripts or direct input from a
command prompt. Before you can use DiskPart commands,
you must first list, and then select an object to give it focus.
When an object has focus, any DiskPart commands that you
type will act on that object.
You can list the available objects and determine an object's
number or drive letter by using the list disk, list volume,
list partition, and list vdisk commands. The list disk, list
vdisk and list volume commands display all disks and
volumes on the computer. However, the list partition
command only displays partitions on the disk that has
focus. When you use the list commands, an asterisk (*)
appears next to the object with focus.
When you select an object, the focus remains on that object
until you select a different object. For example, if the focus
is set on disk 0 and you select volume 8 on disk 2, the focus
shifts from disk 0 to disk 2, volume 8. Some commands
automatically change the focus. For example, when you
create a new partition, the focus automatically switches to
the new partition.
You can only give focus to a partition on the selected disk.
When a partition has focus, the related volume (if any) also
has focus. When a volume has focus, the related disk and
partition also have focus if the volume maps to a single
specific partition. If this is not the case, focus on the disk
and partition is lost.

DiskPart commands
To start the DiskPart command interpreter, at the
command prompt type:
diskpart
Important
Membership in the local Administrators group, or
equivalent is the minimum required to run DiskPart

equivalent, is the minimum required to run DiskPart.


You can run the following commands in the Diskpart
command interpreter:
Active
Add
Assign
Attach vdisk
Attributes
Automount
Break
Clean
Compact vdisk
Convert
Create
Delete
Detach vdisk
Detail
Exit
Expand vdisk
Extend
Filesystems
Format
GPT
Help
Import
Inactive
List
Merge vdisk
Offline

Online
Recover
Rem
Remove
Repair
Rescan
Retain
San
Select
Set id
Shrink
Uniqueid

Additional references
Command-Line Syntax Key

Community Additions

redirection fails
Redirection to a text file fails in Windows 8 - see the batch file
snippet below. list.txt becomes a zero byte file.

@echo off
> script.tmp echo list disk
>> script.tmp echo exit
diskpart /s "%cd%\script.tmp" >"list.txt"
del script.tmp

Additionally: diskpart does not use the current directory and the
%CD% is required for it to find the script file.

foxidrive
4/10/2013

Usage in a script
The url "http://fogproject.org/forum/threads/extend-your-diskpartition-to-max.3640/#post-9233" displays an example of its use
in a script. Its goal is to expand a partition after imaging a
computer.
Paul Moisant
2/25/2013

How do you use diskpart in a script?


"DiskPart is a text-mode command interpreter that enables you to
manage objects (disks, partitions, volumes, or virtual hard disks)
by using scripts or direct input from a command prompt."

This doesn't mention how to use scripts instead of direct input


from the command prompt.
Jeremy Morton [MSFT]
1/28/2011

Where is the "attach" command?


Some commands are missing here. ex attach
Tom Benami
TomBenami
11/16/2009

2013 Microsoft. All rights reserved.

Das könnte Ihnen auch gefallen