How do I get a Flash Drive name from the command prompt?


  1. Posts : 456
    Windows 10
       #1

    How do I get a Flash Drive name from the command prompt?


    Hi, I would like to know if it is possible to get a flash drive name form the command line. With flash drive name I don't mean the volume name but how it is shown in taskbar in the remove usb part. I'm looking for something like:

    "Data Travelor 3.0"

    Does anybody know what command would show such information?

      My Computer


  2. Posts : 3,513
    Windows 10 Pro 64-bit 21H1 (May 2021 build 19043.1083)
       #2

    You could load the CMD (command prompt) and then issue the DIR command to see the folder's contents. If you are trying to see the root folder of a drive, at the beginning you see a description such as "This volume has no name" or "Volume DATA" or similar. To stop scrolling at one screen so you can read the description you need to use the pause attribute. So if your flash drive is F: you should issue the following commands (press ENTER at the end to execute) :

    Code:
    f:
    cd \
    dir /p
    The first command changes current Volume to F: (the flash drive). The second command makes sure we are into the root folder, not a subfolder. The last command displays the contents of the current folder but pauses at the end of the screen so you can read the description at the beginning. If you need to automate these commands, you hace to create a batch file (DOS script). This is simply a text file containing these commands. To create one open Notepad, copy-paste these commands and save with .bat extension (instead of .txt). If you replace F: with %1 (only in the batch file) you can then use the .bat file with parameter the drive letter of the Volume you want to see, such as:

    Code:
    example.bat F:
      My Computer


  3. Posts : 3,274
    Win10
       #3

    Maybe one of of the WMIC command may be able to with refinement from the following ?

    wmic diskdrive get Model, InterfaceType
      My Computers


  4. Posts : 3,513
    Windows 10 Pro 64-bit 21H1 (May 2021 build 19043.1083)
       #4

    Not familiar with that command, sorry. I have not used command prompt since Windows 98 (all I remember is from MS-DOS era). Why do you need to do that in command prompt? If you are creating a program there should be some calls to do the same in GUI. Again not familiar with Visual programming, I have to program since late 90's at University.
      My Computer


  5. Posts : 4,187
    Windows 11 Pro, 22H2
       #5

    From PowerShell, run this command:

    Code:
    Get-Disk | Select Number, FriendlyName

    This will yield a list of disk numbers along with the Friendly Name for each disk. Example:

    Code:
    number friendlyname
    ------ ------------
         2 Crucial_CT500MX200SSD1
         0 SAMSUNG MZHPU512HCGL-00004
         1 ST4000DM000-1F2168
         3 ST8000DM004-2CX188
         5 SanDisk Cruzer
         4 SanDisk Extreme Pro
    Hope that helps!
      My Computers


  6. Posts : 4,187
    Windows 11 Pro, 22H2
       #6

    Let me just add one more piece of information. You can massage the output in countless ways. Looing at my example in my post above, assume you just wanted the friendly name for disk 4. You could do something like this:

    Code:
    get-disk -Number 4 | Select FriendlyName
    
    FriendlyName
    ------------
    SanDisk Extreme Pro
      My Computers


  7. Posts : 456
    Windows 10
    Thread Starter
       #7

    @hsehestedt Thanks I'm writing that down on my useful tips section.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 04:03.
Find Us




Windows 10 Forums