Windows Command Prompt Steps to Recover a Corrupted or RAW USB Drive

Get an ordered, risk-labeled list of Windows Command Prompt steps to diagnose a failing USB drive and recover files before you change or format anything.

Agent prompt for ChatGPT and Claude

You get: Likely cause, step table and if this fails

The prompt

Prompt
Act as a Windows storage support technician who works from the Command Prompt.

My USB drive problem: . My goal: .

Before answering, ask me up to 3 short numbered questions (for example Windows version, drive size and file system, whether a backup exists) and wait for my answers.

Rules:
1. Order steps from read-only diagnosis to changes. No command that writes to the drive comes before the data is copied off or confirmed unneeded.
2. Label every command Safe, Changes data or DESTRUCTIVE, and for DESTRUCTIVE say exactly what it erases.
3. Use only standard Windows commands and switches. Never invent switches; when one depends on the Windows version, tell me to check with /?.
4. For each command, state the expected output and what to do if mine differs.
5. If you are an agent with terminal access (for example in Cursor), do not run any command yourself; only propose them for me to run.
6. If the symptoms point to physical failure (clicking, not detected at all, heat), say so and stop before risky steps. If the data is valuable, recommend a professional data recovery service.

Output format:
1. Likely cause (2-3 sentences)
2. Step table: Step | Command | What it does | Risk | Expected result
3. If this fails: 2-3 next options

End by listing your assumptions and any missing information.

Example output

Example for: usb_symptom = 32 GB SanDisk USB shows as RAW and Windows asks to format drive E:, recovery_goal = get back trip photos (JPG) first, then reuse the drive; answers: Windows 11, drive was exFAT, no backup exists.

1. Likely cause

The exFAT file system metadata on E: is damaged, often from unplugging during a write, so Windows reads the volume as RAW. The photo data itself is usually still on the flash memory. Do not click Format in the Windows prompt.

2. Step table

StepCommandWhat it doesRiskExpected result
1diskpart then list diskLists physical disksSafeA disk of about 29 GB marked Removable. If none appears, stop: possible hardware fault
2list volume then exitShows volumes and file systemsSafeVolume E: with Fs shown as RAW
3chkdsk E:Read-only check without /fSafe"CHKDSK is not available for RAW drives" confirms the file system is unreadable
4Install Windows File Recovery from Microsoft Store, then winfr E: C:\USBRecovery /extensive /n *.jpgScans E: and copies JPG files to C:Safe for E: (writes only to C:)Recovered files in C:\USBRecovery. Mode names differ by tool version: check with winfr /?
5Open C:\USBRecovery and copy the photos to a second locationConfirms the recovery workedSafePhotos open normally. File names may be generic
6format E: /FS:exFAT /Q /V:TRIPCreates a new empty exFAT file systemDESTRUCTIVE: erases everything on E:"Format complete" and E: shows about 29 GB free
7chkdsk E:Verifies the new file systemSafe"Windows has scanned the file system and found no problems"

Only run step 6 after step 5 succeeds.

3. If this fails

  • Step 4 finds no photos: try the tool's other scan mode listed in winfr /?, or stop and contact a data recovery service if the photos matter.
  • Step 6 fails with a write-protect error: in diskpart run attributes disk to check the read-only flag. Persistent errors suggest the stick is failing, so replace it.
  • The drive disconnects during the scan: try another USB port without a hub. If it keeps dropping, treat it as a hardware fault.

Assumptions and missing info: E: is the correct drive letter. C: has more than 32 GB free. The stick has no physical damage. I did not run any commands; paste your outputs back if they differ.

Written by AI from this prompt. Your results will vary.

How to use this prompt

  1. Fill in the USB symptom and what you want to recover or achieve.
  2. Paste the prompt into Cursor chat or another AI assistant.
  3. Answer its questions about Windows version, file system and backups.
  4. Run the Safe steps first, paste the output back, and only continue once your data is copied off.
Who it’s for:
Developers and Windows users fixing a USB drive from the command line
What you get:
An ordered, risk-labeled command plan to diagnose the drive, recover your files and, only afterwards, repair or reformat it.

Use cases

  • A USB stick shows as RAW and Windows asks to format it, but it holds the only copy of trip photos
  • Folders look empty on a flash drive after it was used on a shared PC
  • A drive shows the wrong capacity after being used as a bootable installer
  • Checking a work USB drive for file system errors before reusing it

Works well with

  • Cursor chat: keep it in propose-only mode so the agent never runs disk commands itself
  • Claude or ChatGPT: good at reading pasted command output and adjusting the next step

Try another example

The same prompt filled in for a different situation.

Act as a Windows storage support technician who works from the Command Prompt.

My USB drive problem: Files vanished after plugging into a shared office PC; drive shows 12 GB used but folders look empty. My goal: unhide the original files without formatting or losing anything.

Before answering, ask me up to 3 short numbered questions (for example Windows version, drive size and file system, whether a backup exists) and wait for my answers.

Rules:
1. Order steps from read-only diagnosis to changes. No command that writes to the drive comes before the data is copied off or confirmed unneeded.
2. Label every command Safe, Changes data or DESTRUCTIVE, and for DESTRUCTIVE say exactly what it erases.
3. Use only standard Windows commands and switches. Never invent switches; when one depends on the Windows version, tell me to check with /?.
4. For each command, state the expected output and what to do if mine differs.
5. If you are an agent with terminal access (for example in Cursor), do not run any command yourself; only propose them for me to run.
6. If the symptoms point to physical failure (clicking, not detected at all, heat), say so and stop before risky steps. If the data is valuable, recommend a professional data recovery service.

Output format:
1. Likely cause (2-3 sentences)
2. Step table: Step | Command | What it does | Risk | Expected result
3. If this fails: 2-3 next options

End by listing your assumptions and any missing information.

Tips and common edits

Why this works

  • Forcing read-only steps first and labeling DESTRUCTIVE commands stops the most common mistake: formatting before recovering data.
  • Asking for expected output per step lets you compare results and catch problems before moving on.
  • Banning invented switches and pointing to /? keeps commands accurate across Windows versions.

Use when a USB stick shows as RAW, asks to be formatted or hides files. Have the drive letter and Windows version ready. Works in Cursor chat, ChatGPT, Claude or Gemini.

Common edits

  • Swap Windows for macOS or Linux and ask for Terminal commands such as diskutil or lsblk instead.
  • Narrow the file types in the goal (for example .docx or .mp4) so the recovery step filters for them.

Reuse it: Use in a workflowAdapt in the builder

Prompt details

By
Prompts-GPT editors
Published
How prompts are written and checked

Did this prompt work?

More in Cursor
Coding

Recover from Git commit or branch mistakes safely

Step-by-step terminal commands to fix commit mix-ups without losing uncommitted changes. Use it right after pushing or committing to the wrong branch.

AI Coding AgentsClaude Code

Generate Reproducible Bug Fix Specs for Coding Agents

Get a standalone reproduction test script and a precise technical plan to fix a bug, ensuring your AI agent stays focused and avoids unnecessary file changes.

Cursor Call Graph Trace Before You Change a Function

Cursor maps who calls a function and what it calls, with file and line for every step, the callers your planned change could break and the exact tests to run, before any code is edited.

Coding

Paste a Bug Report, Get a Test-First Fix in Any AI Chat

Get a failing test that reproduces your pasted bug, the root cause, the smallest fix as a diff and its risks, in any chat assistant with no repository access needed.

Data Analysis

Triage sudden metric spikes for event tracking bugs

Diagnose whether an unexpected surge in product analytics is real user activity or broken telemetry. Use this before sharing anomalous growth numbers.

Agent Orchestration

Create Error Handling Contracts for AI Agents

This prompt transforms raw stack traces into structured error envelopes that provide agents with specific remediation steps and valid parameter constraints for self-correction.