When you buy any new Laptop, Desktop or any new hard drive, you need to completely format it to erase all data present in it. You have to do it for the installation of a new OS and allow OS to read and write data in it. There are several ways to format a hard drive like using CMD command, Using Windows PowerShell Command or through any third party software. You can also do this task using CMD command.
In this article, we will show you format a hard drive using PowerShell Command. But, Before you go for it I will recommend you make a backup of disk drive first.
We will teach you how to do it but before proceeding further let us know the difference between the CMD and PowerShell.
Difference between CMD And PowerShell: –
The difference between the CMD and Windows Power Shell is object-oriented, and cmd.exe is string-based. Both sound similar but in actual PowerShell is very different from the Command Prompt. It is more complicated than Command Prompt, but also much more powerful. You can run CMD commands in it, but not the opposite. Let’s take a quick look at both.
- It’s a task-based command line interface and scripting environment based on .Net framework.
- It uses much more powerful functions called cmdlets.
- It can interpret Batch command and PowerShell commands.
- The output generated is not only for streaming of a text but a collection of objects.
- It is the command line interpreter for the Microsoft Windows OS.
- This is mainly string-based and is the older batch language with a standard set of functions.
- It can only interpret Batch commands.
- The output generated is just a stream of characters.
How To Format Hard Drive Using PowerShell: –
Now, you know the basic difference between these two. Hence, Let’s start the tutorial that how to do this. Just for the confirmation, You should know that going through this process will erase everything that is present in the disk drive. Now, follow the steps.
Before it, make sure your drive is connected to your Laptop or Desktop. So, You can process further easily.
- Start your Windows system
- Click on to the Windows icon at the start menu.
- Search for Windows PowerShell in right click on the result, and select the Run as administrator. You can also do it by pressing Windows key + X and then select Windows Powershell(Admin).
- To find the drive that you want to format, type the following command and hit Enter:
- Type the following command to clean the drive and press Enter:
In the above command, Number 1 is the number of the choice of your disk. Please make sure to change it with the number of your drive. Choosing the wrong number can cause the loss of the data of the wrong drive.
- Type Y to confirm and press Enter.
- Type the following command to initialize the disk with the default GUID Partition Table (GPT) partition scheme and press Enter:
Again, Make sure to type the correct number of the drive you want to format.
Important: Although it’s recommended to use a GPT partition scheme, if required, you can use the Master Boot Record (MBR) scheme using this command:
- To create a new partition using the NTFS file system, type the following command assigns a name for the drive, and press Enter:
In the above command again Make sure to type the correct number of the drive you want to format. and change myDrive with the name you want to use for the storage.
- Type the following command to assign a drive letter to the USB drive and press Enter:
Again, make sure to change 1 with the disk number change G with the letter you want to assign to the storage.
If you get the error message, run the command one more time or specify another drive letter. Now, once you go through all steps and complete it then you see newly formatted drive by clicking “This PC” icon on the desktop.
After all, this, let’s us know the meaning of the above command that we used in this process.
Get-Disk: – To find the required disk drive.
Clear-Disk -RemoveData: – Used to format the drive.
Initialize-Disk: – Process starting.