Command Prompt – Useful Commands for Your Hard DrivePosted by On


The command prompt is a very powerful tool and there are various tweaks you can use for it. In this article you will learn how to use this tool for running commands that can partition, format or check your hard drive for errors. Before you start, note that in order to be able to run the commands provided below you have to have be logged into Windows with an Administrator account. A guest account cannot make any changes to the hardware configuration of the system.

Another word of caution is that if you use the wrong commands you risk losing data. It is therefore important to be careful and ideally also make a backup.

Creating a partition from the command line

First, you must type diskpart to access a program called Diskpart. You will then see a message showing the version of Diskpart and the name of your computer.

Once you have launched diskpart, you firstly need to choose which hard drive you will be using to create a new partition. You must do this using the Select command. Type ‘list disk’ to see a list of the hard drives you have access to. You will see something similar to the following picture:

Next, type select, followed by the disk you want to work with. For example, in order to select the disk listed above the right command would be ‘select disk 0’. You will get a message of the form ‘disk 0 is now the selected disk’.

To create a new partition you use the command ‘create partition’, followed by the type and size of the partition. The new partition will have to have a size less than or equal to the amount of free space.
To create a new primary partition size of 10000 MB, say, you would need to type ‘create partition primary size = 10000’. Use this command but change the size depending on how large you want your new partition to be.

After you create the new partition you can also allocate a letter to the new partition just created using the assign command. For example, assigning the letter R can be done using ‘assign letter = R’. Finally, in order to use the new partition, you also have to format it. You can format a partition using the format command, followed by the type of the partition and the type of format. For example, the command ‘format fs=ntfs quick’ would format the partition to NTFS using quick format. To find out more about the different uses of the format command just type help format.

When you’re done with diskpart, type exit to exit the command.

Deleting a partition using Command Prompt

If you want to remove a partition from your hard drive, the procedure is quite simple. First, run diskpart. Then, select the partition you want to delete and type delete partition. You can see an example in the screenshot below.

Checking a Hard Disk / Partition for errors

Last but not least, you can also use the Diskpart tool to check a partition or the entire hard drive for errors. This can be done using the chkdsk command, followed by the letter of the partition.

Computing

Comments are disabled.