How to Repair Flash Drive Using CMD without Losing Data

Want to repair flash drive using CMD? Do not worry too much. On this page, you will know how to repair flash drive using CMD and protect your data from data loss.


By Zoey / Updated on April 2, 2024

Share this: instagram reddit

A USB flash drive can encounter an array of problems, such as a RAW flash drive, a failure in recognition by the system, corruption, unreadability, or physical damage. Windows users have the option to repair flash drive using CMD.

This method enables the resolution of flash drive glitches without resorting to third-party software or formatting. Given the involvement of the Windows Command Prompt, meticulous attention to each step is advised.

Recover Data on a Flash Drive without Data Loss

If you need to repair USB using CMD, one of the most important tips is to recover data from your flash drive, avoiding data loss.

For a non-destructive USB flash drive recovery, a proficient Windows data recovery tool, MyRecover, comes to the rescue. The software employs two advanced scanning methods to seamlessly retrieve all data from the USB flash drive.

This tool boasts the following advantages:

  • Demonstrates a high success rate and rapid recovery speed.
  • Recovers a spectrum of file types, including Word documents, Excel files, PPTs, images, videos, and compressed files, encompassing over 200+ formats.
  • Maintains original file names, formats, quality, and paths for recovered data.
  • Employs a filtering mechanism for immediate recovery of specific files during the scanning process, bypassing the waiting period for the scan's completion.
  • Compatible with Windows 7, 8, 10, 11, and Windows Server, facilitating data recovery on Windows 11 and other data loss scenarios.

To initiate the process, download MyRecover, the Windows data recovery software, and install it on your Windows PC. Simultaneously, connect the flash drive properly.

Download Software Windows 11/10/8/7/Server
Secure Download

Step 1. Launch MyRecover Windows data recovery software. Hover the mouse over the drive saved deleted files before, and click Scan.

Choose the RAW Partition Start Scan

Step 2. The software will perform two comprehensive scanning methods- Quick Scan & Deep Scan automatically, unveiling all flash drive data. The subsequent window will display any discovered files. Preview and select files for immediate recovery.

Scanning RAW Partition

★Tips: For targeted file retrieval, directly input the file name in the Search for files or folders field or utilize the Filter feature. Filters include file type (e.g., Word documents), date modified, or size.
Type: Encompasses all locally stored file types, spanning images, videos, documents, emails, web pages, and compressed files.
Date Modified: Supports options like today, yesterday, the last 7 or 30 days, or customized dates.
Size: Enables size-based filtering, from under 128KB to 1MB to 512MB and beyond, or customizable sizes.

Step 3. Following the scanning phase, select all data from the designated drive and initiate recovery by clicking Recover X files.

Choose Files from RAW Partition

📌 Notes:

  • MyRecover will indicate the number and total size of recoverable files, allowing free recovery of files up to 500MB. For unrestricted recovery, an upgrade is recommended.
  • Choose a new storage location on the flash drive (to be formatted) for retrieved files. Recovering files to their original location risks overwriting deleted data, hampering successful recovery.
  • The software's functionality extends to recovering deleted files from Windows Server versions like Windows Server 2016, 2019, and 2022.

Repair Flash Drive Issues Using CMD

CMD can be used to execute any installed program on your computer. The process is straightforward: input "cd [filepath]" in the Command Prompt, substitute [filepath] with the Windows Explorer path to the desired file, and press Enter. Subsequently, type "start filename," replacing "filename" with the executable file's name, and execute.

You can use CMD command to recover files from USB. And several methods can effectively perform pen drive repair with CMD. Three methods here necessitate no additional software downloads, employing the Windows Command Prompt.

Approach 1. Rectify Hidden Files on Flash Drive via CMD (Attrib)

One method to recover USB drive files via CMD involves the use of the "attrib" command. Occasionally, malware alters file and directory attributes, rendering them inaccessible or hidden.

The "attrib" command in CMD restores original attributes, reinstating access to files and folders.

Instructions for using the "attrib" command:

1. Input "cmd" in Windows Search (Windows Key + S) and right-click Command Prompt in the search results, selecting "Run as administrator."

Run as Administrator

2. In the console, type the drive letter followed by a colon (e.g., X:), where "X" represents the USB drive's drive letter, and press Enter.

3. Next, input the following command and press Enter: "attrib -h -r -s /s /d drive letter:\*.*".

Attrib CMD

4. Files previously obscured due to a virus should now become visible.

Approach 2. Rectify Corrupted Flash Drive with CHKDSK

CHKDSK, an inherent Windows command line utility, is instrumental in rectifying USB drives via CMD. It systematically scans and identifies disk errors, including the detection and repair of bad sectors, and resolving drive corruption.

💡 Note: The CHKDSK command is ineffective for RAW USB drives, except if the USB drive was initially formatted in the NTFS file system.

Following CHKDSK execution, scanning the drive with USB data recovery tools can recover any potentially lost data.

The process for fixing a USB drive via CMD using CHKDSK is as follows:

1. Launch Command Prompt as administrator, using Windows Search (Windows Key + S).

2. In the CMD console, type "chkdsk F/f" (replace "F" with the USB drive's letter) and press Enter.


3. Allow CHKDSK to complete the scan and repair process. The duration may vary based on the USB drive's size.

Approach 3. Format Flash Drive Using DIKSPART Command

Diskpart, a Windows command line utility, facilitates the management and modifications of physical and virtual drives. Employing Diskpart to format a RAW or corrupted USB drive not recognized into a recognized format constitutes an effective CMD-based method for USB drive repair.

Although formatting erases all USB drive data, recovery remains possible through data recovery software like MyRecover mentioned above, especially when opting for Quick Format. Careful execution of Diskpart commands, with the inclusion of specified parameters, is pivotal.

A tutorial for performing a Quick Format on a USB drive using Diskpart is as follows:

1. Search "CMD" in Windows Search (Windows Key + S). Launch Command Prompt as administrator.

2. Input "diskpart" in the console and press Enter.

3. Type "list disk" and Enter to enumerate connected storage devices.

4. Subsequently, input "select disk x" (replace "x" with the USB drive's disk number) and press Enter. If, for example, the disk number is 1, replace "x" with 1.

5. Enter "list volume" and press Enter.

6. Input "select volume x" (substitute "x" with the volume number), then press Enter. Volume number identification can rely on volume size or drive letter.

7. Lastly, input "format fs=ntfs quick" and press Enter. Diskpart will expedite a Quick Format on the USB drive. Alternatively, choose a different file system like FAT32 or exFAT by substituting "ntfs" accordingly.


Written in the End

While repairing flash drive using CMDrectification eradicates the need for third-party software, it's advisable to employ utilities like MyRecoverfor data recovery. In cases of severe corruption, data recovery might precede repair, as formatting could become essential to salvage the drive.

Zoey · Editor
Zoey works as an English editor of AOMEI Technology. She provides tech information about backup and restore, mobile data transfer, and so on for AOMEI. She hopes that her articles will be greatly helpful for users. She is fond of music, film, and photography.