How to change drive letter using PowerShell on Windows 10

If the a new drive is missing on your device, it could be a letter assignment issue – Here are the steps to use PowerShell to quickly assign a new letter.

PowerShell change drive letter on Windows 10
PowerShell change drive letter on Windows 10

On Windows 10, when you connect an internal or external drive to your computer, it’ll get a drive letter assigned automatically to identify the logical partition inside of the drive.

A drive letter, or device letter, can be any letter from the English alphabet, but excluding the letter C, as it’s reserved for the main drive that contains the OS installation.

Although the assignment process happens automatically, sometimes it could happen that Windows 10 tries to assign a letter that is already in use, preventing the new drive from appear in File Explorer.

If you happen to run into this problem, or you simply want to change the drive letter for any reason, Windows 10 offers multiple ways to do this. However, using PowerShell is perhaps one of the most reliable ways to assign a new drive letter.

In this guide, you’ll learn the steps to change the drive letter using the PowerShell command-line console on Windows 10.

How to assign new drive letter using PowerShell

The process to format a drive and get it ready to store data is straightforward. Just make sure to understand that going through these steps will erase everything stored in the drive. 

  1. Open Start.

  2. Search for Windows PowerShell, right-click the result, and select Run as administrator.

  3. Type the following command to identify the hard drive you want to change the letter and press Enter:

  4. Type the following command to assign or change the drive letter to internal or external and press Enter:

    Get-Partition -DiskNumber 1 | Set-Partition -NewDriveLetter G

    In the above command, make sure to change 1 with the disk number of the drive you want to format, and change G with the letter you want to assign to the storage.

    Change drive letter using PowerShell
    Change drive letter using PowerShell

Once you’ve completed the steps, the drive will now have a new letter assignment, and if it was missing, the hard drive will now appear in File Explorer.

About the author

Mauro Huculak is a Windows How-To Expert who started Pureinfotech in 2010 as an independent online publication. He has also been a Windows Central contributor for nearly a decade. Mauro has over 14 years of experience writing comprehensive guides and creating professional videos about Windows and software, including Android and Linux. Before becoming a technology writer, he was an IT administrator for seven years. In total, Mauro has over 20 years of combined experience in technology. Throughout his career, he achieved different professional certifications from Microsoft (MSCA), Cisco (CCNP), VMware (VCP), and CompTIA (A+ and Network+), and he has been recognized as a Microsoft MVP for many years. You can follow him on X (Twitter), YouTube, LinkedIn and