Windows cmd просмотр дисков

  • Home
  • Partition Manager
  • CMD List Drives: How to List Drives in Command Prompt? [Answered]

By Ariel | Follow |
Last Updated

Sometimes you may to need list all drives on your systems. How to list drives in CMD/PowerShell? This post of MiniTool provides a full guide on PowerShell/CMD list drives and a professional tool to manage your drives.

When formatting a drive or copying files from a drive to another drive, you may need to use the CMD or Windows PowerShell tool to list drives. However, many people don’t know how to list drives in Command Prompt or PowerShell, like a user from the superuser forum:

Is there a way to list the available drives from cmd.exe? (Other than manually typing c: d: …) and seeing which ones return errors.https://superuser.com/questions/139899/see-available-drives-from-windows-cli

How to List Drives in CMD

Command Prompt, also known as CMD, is the command-line interpreter in Windows operating system. You can input certain commands in the Command Prompt window to take corresponding actions. If you want to list drives of your systems, you can use the WMIC (Windows Management Instrumentation for Management) or Diskpart command.

List Drives CMD via WMIC:

Step 1. Press Win + R keys to open the Run dialog box, and then type cmd in it and press Ctrl + Shift + Enter keys together to open the elevated Command Prompt window.

open Command Prompt window

Step 2. To let CMD list drives, type one of the following commands and hit Enter.

  • wmic logicaldisk get name
  • wmic logicaldisk get caption

list drives CMD

Step 3. If you want to display the Device ID and volume name, type the following command and hit Enter. Also, you can run the fsutil fsinfo drives command to list drives on your computer

wmic logicaldisk get deviceid, volumename, description

display device ID using CMD

List Drives CMD via Diskpart:

DiskPart is a disk partition management tool that uses command lines to perform operations. It can be used to list drives CMD as well. Here’s how to use it.

Step 1. Open the Command Prompt window again as we explained above.

Step 2. Type the following commands in order and hit Enter after each one. Then you will see a list of drives on the disk, including partition/volume number, label, letter, file system, size, and status.

  • diskpart
  • list disk
  • select disk *
  • list volume/list partition

list drives using diskpart in Command Prompt

How to List Drives in PowerShell

PowerShell is a command-line tool like CMD. Here you can let PowerShell list drives as well. To do so, follow the steps below:

Step 1. Open the Run dialog box, and then type powershell in it and hit Enter.

Step 2. In the Windows PowerShell window, type the following command and hit Enter.

get-psdrive -psprovider filesystem

PowerShell list drivers

How to let PowerShell/CMD list drive letters? Now, I believe that you already have known the answer.

Better Choice Than PowerShell/CMD List Drives

Although both of the two Windows tools can help you list drives, you may encounter some limitations to further managing drives/disks with them. For example, you can’t format a drive larger than 32GB to FAT32 using CMD. If you want to manage your hard disk or partitions more effectively, it’s highly recommended that you use a professional tool like MiniTool Partition Wizard.

MiniTool Partition Wizard DemoClick to Download100%Clean & Safe

It is a popular partition manager trusted by millions of users around the world. With this tool, you can not only obtain the drive information easily but do many other powerful tasks, including create/extend/move/format/wipe partition, convert NTFS to FAT32 without data loss, convert MBR to GPT, migrate OS, rebuild MBR, recover data, etc.

main features of MiniTool Partition Wizard

About The Author

Position: Columnist

Ariel has been working as a highly professional computer-relevant technology editor at MiniTool for many years. She has a strong passion for researching all knowledge related to the computer’s disk, partition, and Windows OS. Up till now, she has finished thousands of articles covering a broad range of topics and helped lots of users fix various problems. She focuses on the fields of disk management, OS backup, and PDF editing and provides her readers with insightful and informative content.

The «list disk» command in CMD displays all the disks connected to your computer, helping you manage storage devices effectively.

diskpart
list disk

The list disk cmd command is a powerful tool used within the Diskpart utility in the Command Prompt (CMD) on Windows operating systems. Its primary function is to display a list of all the physical disks connected to your computer. This command is particularly useful for system administrators and advanced users who need to manage disk partitions and check disk health without relying on graphical interfaces.

List Disk Cmd Windows: Quick Guide to Disks Management

List Disk Cmd Windows: Quick Guide to Disks Management

How to Access the Command Prompt

Before you can use the list disk cmd command, you’ll need to access the Command Prompt. Here’s how to do that on various Windows versions:

Windows 10 & 11

  1. Press Windows + R to open the Run dialog.
  2. Type `cmd` and press Enter.
  3. Alternatively, you can right-click on the Start button and select Windows Terminal (Admin) or Command Prompt (Admin).

Windows 8

  1. Right-click the Start button.
  2. Choose Command Prompt (Admin) from the context menu.

Windows 7

  1. Click on the Start button.
  2. Navigate to All Programs > Accessories.
  3. Right-click on Command Prompt and select Run as Administrator.

Alternatives to Launch CMD

  • You can launch CMD from the Search bar by typing `cmd` and selecting the program.
  • For advanced users, the Power User Menu can be accessed by right-clicking on the Start button or pressing Windows + X, followed by choosing Windows Terminal.

Stop Cmd Command: A Quick Guide to Mastering It

Stop Cmd Command: A Quick Guide to Mastering It

Using the List Disk Command

Getting Started with Diskpart

The list disk cmd command is part of the Diskpart utility, which is a more advanced disk management tool. To use it, you need to start Diskpart:

diskpart

Upon executing this command, you will enter the Diskpart application, where you can perform various disk management tasks.

Executing the List Disk Command

Once you are in Diskpart, you can execute the list disk cmd command to view all connected disks:

list disk

Explanation of Expected Output

You will see an output table that provides various details about the disks connected to your system, including:

  • Disk number: Identifies each disk by its number.
  • Status: Indicates if the disk is online or offline.
  • Size: Displays the total storage capacity of the disk.
  • Free: Shows available space on the disk.
  • Dyn: Indicates if the disk is dynamic.
  • Gpt: Shows if the disk uses GUID Partition Table format.

Example Output

For instance, executing the list disk cmd command might yield the following output:

Disk ###  Status         Size     Free     Dyn  Gpt
--------  -------------  -------  -------  ---  ---
Disk 0    Online         500 GB   200 GB        *
Disk 1    Online         1 TB     500 GB        

In this output, Disk 0 is 500 GB, with 200 GB of free space, and it’s initialized with GPT. Disk 1 is a 1 TB disk with 500 GB free space.

Mastering the Virus Cmd Command in Quick Steps

Mastering the Virus Cmd Command in Quick Steps

Additional Commands for Disk Management

Manipulating Disks with Commands

Once you have a list of your disks, you may want to execute additional Diskpart commands for further disk management. These include:

  • select disk [number]: This command allows you to select a specific disk for further operations.
  • detail disk: Provides detailed information about the selected disk.
  • clean: Erases all partitions and data on the selected disk.
  • create partition: Creates a new partition on the selected disk.

Example: Selecting a Disk for Management

Here’s how to select a disk and check its specific details using Diskpart:

select disk 0
detail disk

By executing the above commands, you can view further details such as the health of the disk, its partitions, and its file system.

Mastering the Route Cmd Command in Minutes

Mastering the Route Cmd Command in Minutes

Common Issues and Solutions

Errors When Using List Disk

Sometimes, you may encounter errors while executing the list disk cmd command. Common error messages include:

  • «Diskpart has encountered an error»: This can occur due to permission issues, make sure to run CMD as an administrator.
  • «No disks found»: This could indicate that your disks are not properly connected or need drivers.

Not Displaying Disks

If disks do not appear when you run the list disk cmd command, consider the following:

  • Check Physical Connections: Ensure that all storage devices are securely connected to your computer.
  • Driver Issues: Outdated drivers can prevent disks from being recognized. Make sure that all drivers relating to your storage devices are up to date.

Mastering Cmd Diskpart Commands: A Quick Reference Guide

Mastering Cmd Diskpart Commands: A Quick Reference Guide

Best Practices for Disk Management

To maintain optimal disk performance and organization, consider the following best practices:

  • Regularly use the list disk cmd command to monitor your disk health and usage.
  • Always back up important data before performing operations like clean or format.
  • Familiarize yourself with other Diskpart commands for comprehensive disk management.

Trace Cmd Command: A Quick Guide to Network Tracing

Trace Cmd Command: A Quick Guide to Network Tracing

Conclusion

Mastering the list disk cmd command is essential for effective disk management in Windows. This command equips you with the information needed to manage your physical disks efficiently. By exploring the Command Prompt further, you’ll unlock the power of CMD to enhance your system administration skills.

Directory Cmd Commands Made Easy for Beginners

Directory Cmd Commands Made Easy for Beginners

Frequently Asked Questions

What Does Gpt Mean?

GPT stands for GUID Partition Table, which is a modern partitioning scheme that supports larger disks and more partitions than the older MBR (Master Boot Record) system, thus providing better data integrity.

Can I Use List Disk on External Drives?

Yes, the list disk cmd command can be used to display both internal and external drives, provided they are connected to your computer.

Is List Disk Safe to Use?

Executing the list disk cmd command is completely safe. It is a read-only operation that doesn’t modify any disk data, making it a good starting point for disk management tasks.

Содержание статьи:

  • Перечень «сподручных» команд // CMD // Таблицы
    • Для просмотра характеристик устройства, сведений о системе
    • Для работы с сетью
    • Для работы с дисками / флешками
    • Для загрузки и восстановления Windows
    • Общие операции
    • 📌Дополнения
  • Вопросы и ответы: 10

Доброго времени!

Ни для кого не секрет, что очень многие операции в Windows можно выполнять с помощью командной строки (на англ.: CMD). А в некоторых случаях — это, пожалуй, вообще единственный вариант решить вопрос!

Я в своих заметках тоже нередко обращаюсь к ней за помощью. 😉 И в сегодняшней статье, как раз, решил собрать все самые необходимые и популярные команды (думаю, в качестве небольшого сподручного материала, чтобы было куда сослаться «в трудную минуту», — она точно не помешает на блоге).

Заранее предупрежу:

  1. я не ставлю целью разобрать все команды! Только основное, что часто приходиться делать;
  2. часть нижеперечисленных команд нужно выполнять с правами администратора (если оных прав не будет — вместо результата увидите сообщение похожее на «недостаточно прав, или настроена групповая политика»)!

*

*

Перечень «сподручных» команд // CMD // Таблицы

Для просмотра характеристик устройства, сведений о системе

👉 Также в помощь!

1) Программы для проверки и мониторинга температуры процессора, видеокарты, диска

2) Как узнать характеристики компьютера, ноутбука

Команда (скопировать в окно CMD и нажать Enter) Описание команды / результат ее выполнения
1 systeminfo Покажет информацию о системе: версию ОС Windows, модель компьютера (ноутбука), владельца, версию BIOS, кол-во ОЗУ, домен (рабочую группу), имя ПК, сетевые адаптеры и пр.
2 wmic cpu get name Узнать модель ЦП (примерный ответ: «AMD Ryzen 3 5300U with Radeon Graphics.»). Др. способы.
3 wmic bios get serialnumber Серийный номер устройства (ноутбука, например).
4 wmic baseboard get product

wmic baseboard get version

Модель мат. платы / ее версия.
5 wmic bios get SMBIOSBIOSVersion Версия BIOS.
6 wmic path win32_VideoController get name Название видеокарты (др. способы).
7 wmic path win32_VideoController get VideoModeDescription Разрешение экрана, цвета.
8 wmic OS get Caption,OSArchitecture,Version Информация о Windows.
9 wmic DISKDRIVE get Caption Информация о накопителях.
10 wmic /namespace:\\root\wmi PATH MSAcpi_ThermalZoneTemperature get CurrentTemperature Посмотреть температуру ЦП (для перевода в градусы Цельсия — полученное значение нужно  разделить на 10 и отнять 273,15).
11 Winver

или

Ver

Показать окно с версией установленной системы.

-//-

Отобразить версию ОС прямо в окне CMD.

12 Hostname Узнать текущее имя ПК.
13 wmic path softwarelicensingservice get OA3xOriginalProductKey Команда покажет текущий лиценз. ключ Windows.
14
  • slmgr /dlv
  • slmgr /dli
Отображение сведений о лицензии (подробно, кратко).

*

Для работы с сетью

👉 В помощь!

Коллекция заметок по настройки сети и интернета на компьютере.

Команда (скопировать в окно CMD и нажать Enter) Описание команды / результат ее выполнения
1 ipconfig /all Показывает сетевые настройки для сетевых адаптеров (IP-адрес, MAC-адрес, и пр.).
2 ping ya.ru

или

ping ya.ru -t

Определение пинга до ресурса www.ya.ru (разумеется, адрес можно указать свой).

Примечание: второй вариант команды (с наличием на конце -t) запускает безостановочную проверку.

3 GETMAC Посмотреть MAC-адрес.
4 nslookup ya.ru Покажет IP-адрес по доменному имени.
5 netsh wlan set autoconfig enabled=no interface=»Wi-Fi»

Обратная операция:

netsh wlan set autoconfig enabled=yes interface=»Wi-Fi»

Выключает авто-поиск сетей по Wi-Fi (в некоторых случаях это увел. скорость работы Wi-Fi подключения, и снижает пинг!).

Примечание: вместо «Wi-Fi» нужно указать название своего адаптера, используемого для подключения по Wi-Fi.

6 netcfg -d

или

  • ipconfig /flushdns
  • netsh winsock reset
  • netsh int ip reset
Сброс сетевых настроек.*
7 netsh wlan show all Просмотреть всю информацию о беспроводных устройствах.
8 netsh wlan show drivers -//- о драйверах.
9 netstat -abno Информация о текущих подключениях и состоянии портов.

*

Для работы с дисками / флешками

👉 В помощь!

1) Восстановление работы флешки (прошивка) / восстановление пропавших и удаленных файлов с флешки/диска;

2) Лучшие программы для работы с накопителями (флешками, HDD, SSD и пр.).

Команда (скопировать в окно CMD и нажать Enter) Описание команды / результат ее выполнения
1 chkdsk v: /f Проверка диска на ошибки (вместо V — нужно указать свою букву диска).

Рекомендуется запускать после некорректного выключения ПК, при ошибках чтения и пр.

2 diskmgmt.msc Вызвать встроенную утилиту «управление дисками».
3 format E: /FS:exFAT /Q /V:fleska Форматирование диска/флешки (быстрое). Где:

  1. E — буква диска;
  2. exFAT — файловая система (вместо exFAT можно ввести: NTFS или FAT32 || Описание файловых систем);
  3. fleska — это название может быть любым.
4
  • Diskpart
  • List Disk

или

  • Diskpart
  • List Volume
Запуск утилиты Diskpart (для работы с дисками) и просмотр информации о дисках (томах).

Первая команда покажет наличие всех физических дисков, вторая — всех томов на них.

(для просмотра разделов: List Partition)

5 Вводить последовательно (по одной!)

  • Diskpart
  • list volume
  • select volume 1
  • assign letter=R
Второй пример с Diskpart: смотрим все тома на дисках, выбираем первый из них (цифра «1» заменяема!), и присваиваем ему букву «R».
6 Вводить последовательно (по одной!)

  • Diskpart
  • list volume
  • select volume 1
  • clean
Еще один пример с Diskpart: просмотр томов, выбор одного из них и полная его очистка. Будьте аккуратны с этой последовательностью команд, она удаляет информацию!

Кстати, после очистки диска (Diskpart, list disk, select disk 1, clean) его можно конвертировать: convert gpt (или convert mbr).

7 defrag /A /C /U /V Анализ дисков на фрагментацию.
8 defrag C: /W /V Дефрагментация диска «C», и вывод отчета по операции.
9 DEL /F «C:\111\Новый текстовый документ.txt» Принудительное удаление файла * (нужно указать правильный путь до него).

Полезно в тех случаях, когда файл не удается удалить из проводника.

9.1 del /q /f /s %SYSTEMDRIVE%\*.log Удаление всех Log-файлов с системного диска (вместо «.log» можно использовать и др. расширения).
10 RD /S «C:\111» Удаление папки * (также нужно указать путь до нее).
11 VOL D: Вывод серийного номера и названия диска.
12 wmic logicaldisk get name, VolumeName, Size, FileSystem, NumberOfBlocks, description Получить информацию по всем подключенным дискам (объем, имя, тип и пр.). Более подробно тут.

*

Для загрузки и восстановления Windows

📌 Примечание: если у вас не загружается Windows — командную строку можно вызвать с установочной флешки.

Команда (скопировать в окно CMD и нажать Enter) Описание команды / результат ее выполнения
1 chkdsk /x/f/r

можно и так:

chkdsk D: /f

Проверка текущего сист. диска на ошибки (/ либо проверка указанного диска).
2 sfc /scannow Проверка целостности системных файлов.
3 BCDEDIT Диспетчер загрузки Windows
4
  • diskpart 
  • list volume
  • exit

Затем, узнав том с Windows, использовать:

bcdboot d:\windows

Сначала узнаем том, на котором установлена Windows, затем восстанавливаем файлы загрузки.
5
  • DISKPART 
  • LIST VOLUME 
  • SELECT VOLUME=2
  • ASSIGN LETTER=Z 
  • EXIT

Затем ввести:

bcdboot D:\windows /s Z: /f UEFI

Сначала узнаем все тома дисков в системе.

Далее выбираем «ESP» том, он в 99-512 МБ (FAT32) (важно: вместо «2» нужно будет выбрать свой том). Затем присваиваем ему букву Z.

Далее указываем букву тома с Windows (вначале мы узнали и ее тоже) и восстанавливаем файлы загрузки.

6 rstrui Запуск утилиты для отката системы (если есть точки восстановления).
7 sysdm.cpl Создать точку восстановления ОС в окне «Защита системы».
8 wmic.exe /Namespace:\\root\default Path SystemRestore Call CreateRestorePoint “MyRestorePoint”, 100, 7 Создать точку восстановления системы в авто-режиме (без лишних вопросов).
9 bcdedit /set {default} safeboot minimal

или

bcdedit /set {default} safeboot network

Загрузка безопасного режима (можно вводить, загрузившись с установочной флешки). Полезная команда, если в обычном режиме Windows не загружается («лагает»).

—//—

C поддержкой сети.

*

Важно: чтобы отменить загрузку в безопасном режиме — в рабочей Windows используйте команду: bcdedit /deletevalue {default} safeboot 

10 msconfig Конфигурация системы (здесь можно настроить запуск служб, автозагрузку ПО, режим загрузки ОС).
11 dism /online /export-driver /destination:F:\MyDrivers

Dism /online /Add-Driver /Driver:F:\MyDrivers /Recurse

Первая команда создает копию драйверов, вторая — восстанавливает их из копии. Работает в Windows 10/11 (Net Framework 3.5).

*

Общие операции

Команда (скопировать в окно CMD и нажать Enter) Описание команды / результат ее выполнения
1 Pause Ставит на «паузу» выполнение последовательности команд, и ждет нажатия одной из кнопок клавиатуры.
2 net start Просмотр списка запущенных служб.
3 net start WlanSvc

или

net stop WlanSvc

Запустить службу WlanSvc / остановить службу -//-
4 ASSOC Просмотреть таблицу: расширение (например, «.RAR») / программа, которая его открывает.
5 DATE Просмотр и установка даты (полезно, когда не работают параметры ОС).

В помощь: настройка даты и времени в Windows.

6 shutdown.exe -r -f -t 20 Перезагрузка компьютера через 20 сек.

Прим.: время задается в секундах. В 1 часе = 3600 сек.!

7 shutdown /s /t 60 Выключение компьютера через минуту.

Прим.: время задается в секундах.

8 TASKLIST

и доп. в помощь

taskkill /F /IM explorer.exe & start explorer

Просмотр всех выполняемых программ и служб.

Завершение процесса explorer.exe (проводник), и его запуск. Удобная штука, когда диспетчер задач «лагает», или вы в нем не можете «поймать» проводник.

9 wmic computersystem where name=»%computername%» call joindomainorworkgroup name=»homework» Сменить рабочую группу текущему компьютеру (вместо «homework» — напишите свое название).

Необходима перезагрузка ПК!

10 wmic computersystem where name=»%computername%» call rename name=»newpc» Сменить имя компьютеру (вместо «newpc» задайте свое имя ПК).

Необходима перезагрузка ПК!

11 powercfg -a

еще доп.:

powercfg -h on

powercfg -h off

Просмотр режимов выкл. ПК (гибернация, сон и пр.).

***

Вкл. / откл. гибернацию.

12 start /high /D «C:\Games\World of Warcraft Classic» wow.exe Запуск приложения с нужным приоритетом (в моем случае — высокий приоритет, который чаще всего и нужен). Часто помогает снизить тормоза в играх.

Более подробно о приоритетах тут.

13 xcopy C:\Games D:\backup /f /i /y /s Копирует один каталог в другой (без лишних вопросов; с перезаписью файлов!).

Удобно использовать для создания резервных копий нужных папок.

14 dir C:\Fraps /B /S > initial_c.txt

dir c:\initial_c.txt /w/o/s/p

dir c:\*.txt /w/o/s/p
Все файлы из папки C:\Fraps запишет в файл initial_c.txt.

Найдет все файлы на диске «C:» с названием «initial_c.txt».

Найдет все файлы на диске «C:» с расширением «.txt».

15 more c:\Users\initial_c.txt

type c:\Users\initial_c.txt

Прочитать и вывести содержимое текстового файла на экран.
16
  • net localgroup
  • net user alex-local /add
  • net localgroup администраторы alex-local /add
  • Используется для добавления, отображения и изменения локальных групп…
  • Добавление нового пользователя alex-local.
  • Пользователя alex-local сделали админом.
17 HELP Выводит справку по всем командам Windows.
18 EXIT Выход из CMD.

*

📌Дополнения

Показ скрытых файлов

Полезные команды для проводника (позволят отображать скрытые расширения, скрытые и системные файлы):

reg add «HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced» /v HideFileExt /t REG_DWORD /d 00000000 /f

reg add “HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced” /v Hidden /t REG_DWORD /d 1 /f

reg add “HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced” /v ShowSuperHidden /t REG_DWORD /d 0 /f

После выполнения команд — не забудьте перезагрузить проводник (ПК).

*

Как автоматизировать выполнение определенных команд

Например, вам требуется постоянно запускать игру с нужным приоритетом (чаще с высоким), или очищать какие-то папки от мусора (определенных файлов), или еще что…

В этом случае можно сделать так:

  1. создать 📌BAT-файл с нужными вам командами (по ссылке привел все нюансы его создания + примеры) и проверить — оценить, всё ли выполняется правильно после его запуска;
  2. настроить 📌планировщик заданий в Windows, чтобы запускать этот BAT-файл в нужное вам время, например, при каждом включении ПК / или в определенное время (скажем, по вторникам и четвергам с 14-00 до 16-00).

*

Что делать, если не загружается Windows

📌Вариант 1: воспользоваться другим рабочим компьютером и записать установочную флешку с Windows. Также не помешает и LiveCD-флешка (эта «штуковина» позволит загружать «полноценную» Windows с флешки, и, само собой, работать с командной строкой… Для восстановления загрузчика Windows — обратите внимание на эту табличку).

*

📌Вариант 2: воспользоваться телефоном (под Android) и записать на нем установочную флешку. Далее подключить ее к ПК, и загрузиться…

*

📌Кстати, открыть окно командной строки можно и с установочной флешки с Windows: достаточно загрузиться с нее и нажать сочетание Shift+F10. Далее можно выполнить многое из таблиц выше…

Установка Windows — запуск командной строки

Установка Windows — запуск командной строки

*

📌 Рекомендую! Коллекция аварийных флешек, которую нужно иметь на экстренный случай (как раз, когда не загружается Windows).

*

На сим пока всё, дополнения приветствуются!

Успехов!

👋

If you need to obtain a list of all disk drives on a Microsoft Windows system
from a
command line interface (CLI), e.g., a command prompt window, you can do so using

Windows Management Instrumentation Command-line (WMIC). You can obtain
a list of drives by opening a
command prompt window and then issuing a wmic logicaldisk get
command followed by parameters relevant to the information you
wish to see. You can see a list of parameter options by issuing the command
wmic logicaldisk get /?.

C:\>wmic logicaldisk get /?

Property get operations.
USAGE:

GET [<property list>] [<get switches>]
NOTE: <property list> ::= <property name> | <property name>,  <property list>

The following properties are available:
Property                                Type                    Operation
========                                ====                    =========
Access                                  N/A                     N/A
Availability                            N/A                     N/A
BlockSize                               N/A                     N/A
Caption                                 N/A                     N/A
Compressed                              N/A                     N/A
ConfigManagerErrorCode                  N/A                     N/A
ConfigManagerUserConfig                 N/A                     N/A
Description                             N/A                     N/A
DeviceID                                N/A                     N/A
DriveType                               N/A                     N/A
ErrorCleared                            N/A                     N/A
ErrorDescription                        N/A                     N/A
ErrorMethodology                        N/A                     N/A
FileSystem                              N/A                     N/A
FreeSpace                               N/A                     N/A
InstallDate                             N/A                     N/A
LastErrorCode                           N/A                     N/A
MaximumComponentLength                  N/A                     N/A
MediaType                               N/A                     N/A
Name                                    N/A                     N/A
NumberOfBlocks                          N/A                     N/A
PNPDeviceID                             N/A                     N/A
PowerManagementCapabilities             N/A                     N/A
PowerManagementSupported                N/A                     N/A
ProviderName                            N/A                     N/A
Purpose                                 N/A                     N/A
QuotasDisabled                          N/A                     N/A
QuotasIncomplete                        N/A                     N/A
QuotasRebuilding                        N/A                     N/A
Size                                    N/A                     N/A
Status                                  N/A                     N/A
StatusInfo                              N/A                     N/A
SupportsDiskQuotas                      N/A                     N/A
SupportsFileBasedCompression            N/A                     N/A
VolumeName                              N/A                     N/A
VolumeSerialNumber                      N/A                     N/A

The following GET switches are available:

/VALUE                       - Return value.
/ALL(default)                - Return the data and metadata for the attribute.
/TRANSLATE:<table name>      - Translate output via values from <table name>.
/EVERY:<interval> [/REPEAT:<repeat count>] - Returns value every (X interval) se
conds, If /REPEAT specified the command is executed <repeat count> times.
/FORMAT:<format specifier>   - Keyword/XSL filename to process the XML results.

NOTE: Order of /TRANSLATE and /FORMAT switches influences the appearance of outp
ut.
Case1: If /TRANSLATE precedes /FORMAT, then translation of results will be follo
wed by formatting.
Case2: If /TRANSLATE succeeds /FORMAT, then translation of the formatted results
 will be done.


C:\>

For example, the results from issuing the command on a Windows 10
system to display the device ID, volume name, and description are shown
below:

C:\>wmic logicaldisk get deviceid, volumename, description
Description       DeviceID  VolumeName
Local Fixed Disk  C:        OS
CD-ROM Disc       D:
CD-ROM Disc       E:
Removable Disk    F:        EMTEC


C:\>

In the above example, drive C: is the internal disk drive in the system
and drive F: is an 8 GB USB 2.0
flash
drive. If I only want to see a particular type of drive, e.g., only
internal disk drives or only removeable
USB-attached
drives, I can add a «where»
argument to the command and specify a drive type. The
values that can be used to specify drive types are shown below:

Value Description
0 Unknown
1 No Root Directory
2 Removable Disk
3 Local Disk
4 Network Drive
5 Compact Disc
6 RAM Disk

For instance, if I only wanted to see local disks, e.g., the internal disk
drive in the system, I could use the command below, which would only show
drive C:

C:\>wmic logicaldisk where drivetype=3 get deviceid, volumename, description
Description       DeviceID  VolumeName
Local Fixed Disk  C:        OS


C:\>

If I only wanted to see removable disks, such as

USB flash drives, attached to the system, I could use the command below:

C:\>wmic logicaldisk where drivetype=2 get deviceid, volumename, description
Description     DeviceID  VolumeName
Removable Disk  F:        EMTEC


C:\>

If I use a drive type of 5, instead, I should see

compact disc (CD) drives.

C:\>wmic logicaldisk where drivetype=5 get deviceid, volumename, description
Description  DeviceID  VolumeName
CD-ROM Disc  D:
CD-ROM Disc  E:


C:\>

In the example above, thought the output shows two
CD-ROM
drives, the system doesn’t actually have any CD-ROM drives in it nor
externally attached to it. Instead, an Android phone is connected to the
Dell laptop by a USB cable and is being reported as drives D: and E:,
though if I attempt to view the contents of those drives, I see «the device
is not ready.»

C:\>dir d:
The device is not ready.

C:\>dir e:
The device is not ready.

C:\>

You can, of course, specify other parameters on the command line. E.g.,
you can request the media type be displayed by including mediatype
as a parameter. The output will then show the type of media currently
present in the logical drive. The value may not be exact for removable drives
if currently there is no media in the drive. E.g.:

C:\>wmic logicaldisk where drivetype=2 get deviceid, volumename, description, mediatype
Description     DeviceID  MediaType  VolumeName
Removable Disk  F:                   EMTEC


C:\>wmic logicaldisk where drivetype=3 get deviceid, volumename, description, mediatype
Description       DeviceID  MediaType  VolumeName
Local Fixed Disk  C:        12         OS


C:\>
C:\>wmic logicaldisk where drivetype=5 get deviceid, volumename, description, mediatype
Description  DeviceID  MediaType  VolumeName
CD-ROM Disc  D:        11
CD-ROM Disc  E:        11


C:\>

The media type values are listed below:

Format is unknown (0)
5¼-Inch Floppy Disk (1)

5 1/4-Inch Floppy Disk — 1.2 MB — 512 bytes/sector

3½-Inch Floppy Disk (2)

3 1/2-Inch Floppy Disk — 1.44 MB -512 bytes/sector

3½-Inch Floppy Disk (3)

3 1/2-Inch Floppy Disk — 2.88 MB — 512 bytes/sector

3½-Inch Floppy Disk (4)

3 1/2-Inch Floppy Disk — 20.8 MB — 512 bytes/sector

3½-Inch Floppy Disk (5)

3 1/2-Inch Floppy Disk — 720 KB — 512 bytes/sector

5¼-Inch Floppy Disk (6)

5 1/4-Inch Floppy Disk — 360 KB — 512 bytes/sector

5¼-Inch Floppy Disk (7)

5 1/4-Inch Floppy Disk — 320 KB — 512 bytes/sector

5¼-Inch Floppy Disk (8)

5 1/4-Inch Floppy Disk — 320 KB — 1024 bytes/sector

5¼-Inch Floppy Disk (9)

5 1/4-Inch Floppy Disk — 180 KB — 512 bytes/sector

5¼-Inch Floppy Disk (10)

5 1/4-Inch Floppy Disk — 160 KB — 512 bytes/sector

Removable media other than floppy (11)
Fixed hard disk media (12)
3½-Inch Floppy Disk (13)

3 1/2-Inch Floppy Disk — 120 MB — 512 bytes/sector

3½-Inch Floppy Disk (14)

3 1/2-Inch Floppy Disk — 640 KB — 512 bytes/sector

5¼-Inch Floppy Disk (15)

5 1/4-Inch Floppy Disk — 640 KB — 512 bytes/sector

5¼-Inch Floppy Disk (16)

5 1/4-Inch Floppy Disk — 720 KB — 512 bytes/sector

3½-Inch Floppy Disk (17)

3 1/2-Inch Floppy Disk — 1.2 MB — 512 bytes/sector

3½-Inch Floppy Disk (18)

3 1/2-Inch Floppy Disk — 1.23 MB — 1024 bytes/sector

5¼-Inch Floppy Disk (19)

5 1/4-Inch Floppy Disk — 1.23 MB — 1024 bytes/sector

3½-Inch Floppy Disk (20)

3 1/2-Inch Floppy Disk — 128 MB — 512 bytes/sector

3½-Inch Floppy Disk (21)

3 1/2-Inch Floppy Disk — 230 MB — 512 bytes/sector

8-Inch Floppy Disk (22)

8-Inch Floppy Disk — 256 KB — 128 bytes/sector

Related articles:

  1. Obtaining the model number and serial number for a HDD from the command line
    Date: October 13, 2015
    MoonPoint Support

  2. Using wmic to get disk drive information
    Date: July 10, 2015
    MoonPoint Support

References:

  1. Win32_LogicalDisk class
    Microsoft Develper Network

Listing drives is done for various reasons in different scenarios by the users. They can use command Prompt (cmd) or PowerShell commands to view the list of all drives with other information. Both provide quick and easy access to the information regarding drives. Here are some of the use cases where one might need to access the drives list through the command prompt and PowerShell:

  • A list of drives is accessed when the user wants to see the information about all drives. E.g. drive size, drive letter, drive type, and free space available on each drive.
  • It is used to automate tasks. For example, using PowerShell to automatically and periodically check the drive status and generate storage reports.
  • The user may sometimes need to check the drive information quickly through the command prompt when he needs to troubleshoot the system. It also helps identify problems. For example, a drive not being recognized or issues with mounted drives.
  • Users may need to integrate command line operations into batch scripts to automate the system administration tasks.
  • For an enterprise, MDM solutions like Airdroid business can use PowerShell scripts to remotely get information about any device’s drive and use it for troubleshooting or support.
  • Storage status of any device can be remotely accessed and managed using a drive list generated through PowerShell scripts or Command Prompt.

Let’s now have a look at the step-by-step process on how you can list drives from the command prompt and PowerShell.

  • Part 1 :How to List Drives Using Command Prompt?
  • Part 2 :How to List Drives Using PowerShell?
  • Part 3 :How to Run DiskPart in PowerShell?
  • Part 4 :Troubleshooting Common Issues

Part 1: How to List Drives Using Command Prompt?

You can get a complete list of all drives by using the command prompt (CMD). There are three ways to do so using CMD. Let’s discuss each one of them in detail.

Method 1: Using WMIC Command

  1. Step 1: Open the command prompt and type any of these commands:
    wmic logicaldisk get name
    wmic logicaldisk get caption

    Press Enter key.

  2. Using-WMIC-Command-1

  3. Step 2: Use the command fsutil fsinfo drives and press Enter. You will get a list of drives on your computer. Or else you can also use the following command if you want to see the device ID and volume name:
    wmic logicaldisk get deviceid, volumename
  4. -Using-WMIC-Command-2

Method 2: Using Diskpart

Diskpart is among the oldest and most used tools for listing and managing drives and partitions. Here are the steps to follow in order to get a list of drives using Diskpart:

  1. Step 1: Open the command prompt by typing CMD in the search box and clicking ‘Command Prompt’ from the list that appears.
  2. Using-Diskpart-1

  3. Step 2: Now type the commands given below in sequence and press enter key after typing each command:
    diskpart
    list disk
    select disk X

    (Replace «X» with the disk number)

    list volume

    or

    list partition
  4. Using-Diskpart-2

  5. It will give you a list of drives on your computer along with the letter, size, label, volume number, and health status.

Method 3: Using Dir Command

You can get a list of all files in a directory by using ‘Dir’ command in the command prompt. It will show you the contents of the directory.

When the dir command is executed alone, without parameters, it shows the disk’s volume label and serial number along with the list of directories and files. You will see a result like this one below with and without parameters:

Using-Dir-Command-3

You can use the dir command with a combination of other options to list the files in a customized manner, e.g., here are some of the commonly used commands along with the list type they generate:

/A: Displays files with specified attributes.

/B: Uses bare format (no heading information or summary).

/O: Specifies the order in which files are sorted.

/S: Displays files in specified directory and all subdirectories.

Part 2: How to List Drives Using PowerShell

Another way of getting the list of drives on your computer is by using PowerShell commands. Given below are the four common ways in which PowerShell can be used to list the drives.

1 Get-PSDrive

2 Get-Disk

You can use the Get-Disk cmdlet to retrieve detailed information about the drives, including their health status and total size.

Get-disk-1

3 Use CMD Command

  1. Step 1: In PowerShell, use this CMD command to list the mapped drives:
    Net use
  2. Step 2: To get the mapped drives on remote devices, use the following command:
    Invoke-Command -ComputerName RemoteComputer -ScriptBlock{Net use}

4 WMI and CimInstance

Use WMI method with classname Win32_MappedLogicalDisk to get mapped network drives list.

  1. Local Computer:
    Get-CimInstance -ClassName Win32_MappedLogicalDisk | Select SystemName, DeviceID, ProviderName
  2. Remote Computer:
    Get-CimInstance -ClassName Win32_MappedLogicalDisk -ComputerName RemoteSystem | Select SystemName, DeviceID, ProviderName

5 Use Get-PSDrive Method

Run this cmdlet to list drives on the local computer:

  1. Local Computer:
    Get-PSDrive
  2. Network Drives:
    Get-PSDrive | where{$_.DisplayRoot -match "\\"}
  3. Remote Computer:
    Invoke-Command –ComputerName RemoteComputer -ScriptBlock{Get-PSDrive | where{$_.DisplayRoot -match "\\"}}

6 Specific Disk Information

You can use this cmdlet in PowerShell if you want to get information about a specific hard disk:

Get-Disk -Number 6

Replace the number above with the number of disks for which you need information. Press enter, and you will get results.

Use-Get-PSDrive-method-1

7 USB Storage Information

You can also get detailed information about a USB or any other removable storage devices connected to your computer using the following command for PowerShell:

Get-Disk | Where-Object -FilterScript {$_.Bustype -Eq "USB"}

Part 3: How to Run DiskPart in PowerShell

You can access DiskPart through PowerShell and list the drives on your computers and even perform functions like creating partitions or volumes, deleting them, or even formatting them.

  1. Step 1: Open PowerShell by searching for it in the search box, right-click on ‘Windows PowerShell’ in the search results and click ‘Run as Administrator’.
  2. Step 2: Once PowerShell is open, type ‘Diskpart’ and press the enter key.
  3. Step 3: Now, to get the list of disks, you can type ‘list disk’ and press enter. This will provide you the information including disk number, total size, free space, and more.
  4. Step 4: Similarly, you can use ‘list partition’ command and press enter to access the information about the partition.

4 Troubleshooting Common Issues

Sometimes, you may encounter problems while trying to run Command Prompt or PowerShell to list the drives. Here are some of the common issues faced by the users along with their solutions.

1 Why is the Command Not Recognized?

Cause: The command was entered incorrectly or the command prompt is not running as an administrator.

Solution:

  • Check the command syntax: Make sure the command is entered correctly without typos. For example, wmic logicaldisk get name should be complete.
  • Run as administrator: Some commands require elevated privileges to run. Right-click the command prompt icon and select «Run as administrator».

2 Why Am I Getting Access Error?

Cause: Insufficient user permissions or incorrect file/directory permissions.

Solution:

  • Verify user permissions: Make sure the current user has the permissions required to execute the command. If necessary, log in with an administrator account.
  • Check file/directory permissions: If the operation involves a specific file or directory, right-click the file or directory, select «Properties», and check the permission settings in the «Security» tab.

3 Why is the Drive not Found?

Cause: The drive is not connected properly or is not recognized by the system.

Solution:

  • Check the physical connection: Make sure the drive is properly connected to the computer.
  • Refresh the drive list: Enter diskpart in the command prompt, and then enter rescan to refresh the drive list.

4 Why Is the Drive Information Incorrect?

Cause: Cache issue or system information not updated.

Solution:

  • Refresh system information: Restart the computer or use the diskpart command to refresh the drive information.
  • Use the latest tools: Make sure you are using the latest version of the Command Prompt or PowerShell tool.

AirDroid Business is an Windows and Android device management solution that can be used to enroll, manage, and monitor large fleet devices. With the centralized platform, organizations are able to deploy smartphones, tablets, rugged devices and others dedicated devices like kiosks and digital signage.

It’s available for Cloud Deployment & On-Premises Deployment.

Key features include: remote access & control, Google Play apps & enterprise’s apps management, policy, single & multi-apps kiosk mode, alerts & automated workflows, geofencing & location tracking, file transfer, notification, user management, reports, etc.

14-days Free Trial

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Как переименовать шрифты в windows 10
  • Certificate store in windows
  • Обновить windows 10 до windows 11 с сохранением данных
  • Midtown madness для windows 10
  • Total commander windows 7 x32