Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

How to Format a USB Drive on Windows Using CMD and PowerShell

Formatting a USB drive is a common task that can be necessary for various reasons, such as removing all data, changing the file system, or preparing the drive for a new use. In the Windows environment, this can be accomplished using graphical tools like File Explorer or using command-line tools such as Command Prompt (CMD) and PowerShell. This article will guide you through the process of formatting a USB drive using CMD and PowerShell.

Formatting a USB Drive Using Command Prompt (CMD)

  1. Open Command Prompt as Administrator:

    • Press Win + X and select "Command Prompt (Admin)" or "Windows PowerShell (Admin)" from the menu.
  2. Identify the USB Drive:

    • Type diskpart and press Enter. This will open the DiskPart utility.
    • Type list disk and press Enter. This will display all connected drives. Identify your USB drive by its size.
  3. Select the USB Drive:

    • Type select disk X (replace X with the disk number of your USB drive) and press Enter.
  4. Clean the Drive:

    • Type clean and press Enter. This will remove all partitions and data from the drive.
  5. Create a New Partition:

    • Type create partition primary and press Enter.
  6. Format the Drive:

    • Type format fs=ntfs quick and press Enter to format the drive with the NTFS file system. You can replace ntfs with fat32 or exfat if needed.
  7. Assign a Drive Letter:

    • Type assign and press Enter. This will assign the next available drive letter to the USB drive.
  8. Exit DiskPart:

    • Type exit and press Enter to close DiskPart.

Formatting a USB Drive Using PowerShell

  1. Open PowerShell as Administrator:

    • Press Win + X and select "Windows PowerShell (Admin)" from the menu.
  2. Identify the USB Drive:

    • Execute the command Get-Disk to list all connected drives. Note the number of your USB drive.
  3. Clear the Drive:

    • Use the command Clear-Disk -Number X -RemoveData (replace X with the disk number) and confirm the action.
  4. Initialize the Drive:

    • Run Initialize-Disk -Number X to initialize the disk.
  5. Create a New Partition:

    • Execute New-Partition -DiskNumber X -UseMaximumSize -AssignDriveLetter to create a new partition and assign a drive letter.
  6. Format the Drive:

    • Use Format-Volume -DriveLetter Y -FileSystem NTFS -NewFileSystemLabel "USBDrive" to format the drive. Replace Y with the assigned drive letter, and you can change NTFS to FAT32 or exFAT if desired.

Conclusion

Formatting a USB drive using CMD or PowerShell provides a powerful alternative to graphical tools, especially when dealing with stubborn drives or when scripting is required. Both methods offer flexibility in choosing the file system and partitioning options.

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.