FreePrograms.me

Formatting a flash drive via the command line

Форматирование флешки через командную строку


Almost all users have to deal with the command line, sooner or later. Firstly, because all modern versions of Windows are, in fact, graphical shells of the good old disk OS and operations carried out in DOS mode (via the command line) in any case will proceed “directly”, which means faster and more efficiently. Secondly, many settings are not supported by the graphical shell at all, which means they can only be done through the command line.

Formatting a flash drive via cmd



Everyone knows that formatting flash drives (flash drives) can be done under Windows. It would seem, why use the command line (cmd) if you have such a convenient tool? However, experience shows that active viruses, damaged flash drives, and OS malfunctions do not always make it possible to format using standard tools.

In these cases, the fault is also often in the serviceability of the USB ports or their individual contacts, because the system asks you to check whether the drive is connected correctly and to make sure that the disk is not write-protected (and as is well known, flash drives do not have write protection at the hardware level). In this case, the flash drive can be recognized by the system.


Stage 1: Run cmd with administrator rights



Administrator rights may be required to work with cmd. If you are logged into a Windows user account, simply opening a command prompt is not enough.

  1. To do this, right-click on the command line shortcut and select "Run as administrator".

    Запуск командной строки от имени администратора


  2. After this, in the cmd title you will see the word "Administrator".

    Запущенная командная строка от имени администратора



Stage 2: Format via the command line



The command line ignores all warnings from the graphical shell and does not require the help of third-party programs; acts directly using disk operating system procedures and commands.

  1. In order to format the drive via cmd, we need the command "format A:" (if the system recognizes the flash drive as a disk (A:). To find out what letter the system recognizes your flash drive, just go to "My computer". In our case, Windows OS sees the flash drive as "Removable drive E".

    Просмотр присвоенной буквы флешке


  2. Launch the command line as administrator and enter the following command:

    format /FS:NTFS E: /q


    This improved command allows the system to:

    • format the drive with the letter (E:);
    • use the NTFS file system;
    • perform a quick format. "/Q" means the procedure will be quick. If you need the complete one, just don't use this command.


  3. After clicking on "Enter" the system will ask you to insert a disk (E:). This is a normal procedure, since cmd does not yet know whether you have installed the USB flash drive or not.

    Стандартная команда форматирования флешки через командную строку


  4. If you make a mistake in the drive name, the command line will immediately let you know.

    Сообщение с ошибкой при указании буквы диска в командной строке


  5. After we click "Enter" The command line displays text information about our flash drive and formatting type.

    Информация о флешке и типе форматирования через командную строку


  6. Click here "Enter". The system structures the file system (the formatting procedure takes place).

    Структурирование файловой системы флешки при форматировании через командную строку


  7. The procedure ends.

    Завершенная процедура форматирования флешки через командную строку



Formatting failures on the command line



Despite the fact that the formatting procedure via cmd is the most optimal way to create the file system structure of a flash drive, the command line is not a panacea for all problems. It rarely happens that DOS cannot determine the number of sectors.

Сбой форматирования флешки через командную строку


Such problems indicate problems with the flash drive. This does not mean that the flash drive immediately after the message "Format failed" should be thrown away. To do this, you need to restore the sectors of the flash drive. After the recovery procedure, almost all drives are successfully formatted and are suitable for reading and writing files.

Recovery command:

chkdsk E: /F /R


Letter "E" - disk number, subcommand "F" - error correction, subcommand "R" means recovery of bad sectors.

After the “chkdsk” command, the verification and correction procedure starts.

Запущенная утилита chkdsk для флешки в командной строке


As a result, when the process is completed, you need to try formatting again.

Повторный запуск форматирования флешки через командную строку


Additional commands to help you format



If you need to format a flash drive while creating a disk label (name), you should use the command:

format F: /fs:NTFS /v:MyFlash


Where "MyFlash" - new, created label.

Форматирование флешки через командную строку с меткой диска


The result is as follows.

Результат форматирования флешки с меткой диска через командную строку


Also worth noting is the command Diskpart, which runs an application program that manages disk space.
The following commands operate within this utility:

  1. "List disk" - displaying the entire list of disks;
  2. "select disk 2" - in this case the number "2 » corresponds to the drive we selected;
  3. “attributes disk clear readonly” - starting the attribute cleaning process.
  4. "Clean" - starting the drive cleaning process;
  5. "Create partition primary" - creation of a primary partition.
  6. "format fs=NTFS" - quick formatting of the drive.
  7. "Exit" - exit the “diskpart” program.


Дополнительные команды форматирования флешки через командную строку
If, despite the variety of commands using the command line, you are unable to format the flash drive, then you should turn to low-level formatting programs for help.
August 02, 2018 4
Comment
Enter the code below:*
Click on the image to update the code if it is illegible
  1. ahhlov
    ahhlov
    4 December 2023 20: 51
    everything worked! very cool! I like it! 
  2. Stason
    Stason
    5 December 2023 20: 40
    I formatted all flash drives using this line. Thank you
  3. Diz1k
    Diz1k
    6 December 2023 13: 49
    Everything works great thanks for the help and great article 
  4. Basketball
    Basketball
    6 December 2023 23: 31
    I formatted the flash drive well and quickly, I liked this method