Windows
Installing Windows from command prompt feels like unlocking a secret backdoor into deployment. ⚡ I’ve used this method to deploy Windows across dozens of machines at Microsoft retail, and it’s faster than the GUI installer once you know the right commands.
The key is starting with a properly formatted USB drive and knowing which switches to use with setup.exe—something most guides skip.
You’ll need a bootable USB (at least 8GB) with Windows ISO files extracted, plus admin access to run commands. The process takes about 15 minutes once you’ve got the USB ready, but the real magic happens when you use switches like /auto upgrade or /quiet to automate the installation.
I’ve documented the exact syntax that works for Windows 10/11, including how to handle errors like missing files or permission issues.
By the end, you’ll have a fully automated Windows install that boots straight to desktop—no manual steps required. This method also lets you deploy custom configurations, like disabling telemetry or pre-installing drivers, right from the command line. It’s the technique I still use for bulk deployments today.
We’ll cover troubleshooting common errors like corrupted USB drives or unsupported switches, plus alternative methods using DISM or bcdedit for advanced scenarios. Stick with me, and you’ll be deploying Windows like a pro in no time.
📚 In This Guide
- What you need
- Instructions
- Tips and common mistakes
- Wrapping up and next steps
What you need
- ● Windows ISO file: Download the latest blank">Windows 11 ISO (or Windows 10) from Microsoft’s official site. Size: ~4-5GB.
- ● USB flash drive: A blank or erasable USB with at least 8GB capacity (16GB recommended for future-proofing). Note: All data on it will be wiped!
- ● PC with Command Prompt access: A Windows PC (or another OS with blank">WSL if needed).
- ● Rufus or DiskPart: Either blank">Rufus (GUI tool) or built-in diskpart (Command Prompt method).
- ● Administrator privileges: Ensure your user account has admin rights to run commands.
- ● Third-party tools: blank">WaltrBoot or UNetbootin for alternative USB creation.
- ● Notepad++ or VS Code: For editing batch scripts if you’re really customizing your setup.
- ● External backup: A spare USB or cloud storage to save critical files before wiping your drive.
Step-by-Step instructions for creating a Windows bootable USB via Command Prompt
Here’s how I create a reliable bootable USB—no third-party tools needed, just pure Windows command line.
⌨️ Step 1: Download Windows Media Creation Tool
Open a web browser and navigate to Microsoft’s official Media Creation Tool page. Download the latest version—this ensures you’re using the correct Windows ISO for your target system. I always verify the download by checking the file size matches Microsoft’s published specs (~4.5GB for Windows 11).
Save the executable to your Desktop or a dedicated folder for easy access. Avoid saving it in Downloads—that folder gets cluttered fast, and you’ll waste time digging later. Once downloaded, right-click the file and select Run as administrator to launch it with full system permissions.
⚡ Step 2: Extract the ISO Using Command Prompt
Open Command Prompt as administrator by pressing Win + X, then selecting Terminal (Admin). Type diskpart and press Enter to launch the built-in disk management tool. This is where you’ll prepare your USB drive for writing.
At the DISKPART prompt, type list disk and press Enter. Identify your USB drive by its size—it’ll typically appear as the smallest disk (usually 8GB or 16GB). Note its disk number (e.g., Disk 1) because you’ll need it in the next step. Do not select the wrong disk—this will erase all data on it permanently.
🔧 Step 3: Format and Assign the USB Drive
Type select disk X (replace X with your USB’s disk number) and press Enter. Confirm selection by typing clean—this wipes the drive completely. Next, type create partition primary and press Enter to prepare the partition.
Format the partition as NTFS by typing format fs=ntfs quick and press Enter. Wait for the process to complete—this usually takes 10-30 seconds depending on USB speed. Finally, assign a drive letter by typing assign letter=Y (replace Y with an available letter, like F or G).
💻 Step 4: Mount the ISO and Copy Files
Return to the regular Command Prompt (type exit to leave DISKPART). Navigate to the folder containing the downloaded MediaCreationTool.exe by typing cd Desktop (or your save location) and pressing Enter. Run the tool in silent mode by typing MediaCreationTool.exe /Eula Accept /MediaLanguage en-US /MediaArch x64 /MediaEdition Pro /MediaChannel Retail /MediaType ISO /LimitAccess—this generates the ISO file.
Once the ISO is created, mount it by typing mount d: (replace d: with your drive letter) and press Enter. Then, copy all files to your USB by typing xcopy d:\. Y:\ /E /H /C /I (replace Y with your USB’s assigned letter). This ensures all hidden and system files are copied—critical for a bootable drive.
💡 Step 5: Verify Bootability and Eject Safely
After copying completes, unmount the ISO by typing dismount d: (replace d: with your ISO’s drive letter). Close the Command Prompt and safely eject the USB by right-clicking its drive letter in File Explorer and selecting Eject. Do not unplug it directly—this can corrupt the boot files.
Test the USB on a target machine by booting from it (access boot menu via F12, Esc, or Del, depending on your system). If the Windows setup screen appears, your USB is ready. If not, recheck the file copy step—missing files are the most common issue.
Tips & tricks for perfect bootable USB creation via Command Prompt
I’ve built countless bootable USBs this way—here’s what I’ve learned to make the process smoother and avoid the most common pitfalls.
Double-Check Disk Selection: In Step 2, when you type list disk, take an extra 10 seconds to verify you’ve identified the correct USB drive. I’ve seen users accidentally select their primary hard drive (Disk 0) instead of their USB (Disk 1 or higher). This isn’t just a theoretical risk—it’s happened to me twice before I learned to double-check. Always confirm by size: your USB should be the smallest disk (typically 8GB-16GB) while your system drive will be much larger (250GB+).
NTFS Formatting Timing: The format fs=ntfs quick command in Step 3 usually completes in 10-30 seconds, but don’t rush this step. If you interrupt it by pressing Enter too soon or closing the Command Prompt, you might end up with an incomplete format. I’ve had drives that appeared formatted but wouldn’t boot properly because of this. Let it run to completion—you’ll know it’s done when you see the prompt return without any errors.
Command Prompt Navigation Shortcut: In Step 4, instead of typing the full path to your MediaCreationTool.exe (like cd Desktop), I use this trick: drag the folder containing the tool directly into the Command Prompt window. It automatically inserts the full path for you. This saves time and eliminates typos in long directory paths. Just right-click the folder, drag it into the Command Prompt window, and release—it’ll paste the path automatically.
Xcopy Verification: After running the xcopy command in Step 4, verify all files copied by checking the USB’s capacity. A properly created Windows 11 ISO should occupy about 4.5GB on an 8GB USB. If your USB shows significantly less (like 2GB), you likely missed some hidden system files. The /H flag in the command handles hidden files, but double-checking capacity gives you peace of mind before testing.
Pro Tips for Install Windows From Command Prompt
- I’ve built countless bootable USBs this way—here’s what I’ve learned to make the process smoother and avoid the most common pitfalls.
- Double-Check Disk Selection: In Step 2, when you type list disk, take an extra 10 seconds to verify you’ve identified the correct USB drive.
- NTFS Formatting Timing: The format fs=ntfs quick command in Step 3 usually completes in 10-30 seconds, but don’t rush this step.
Frequently asked questions
Got questions about installing Windows via Command Prompt? You’re not alone! Here are some of the most common concerns—and their solutions—to help you navigate the process smoothly.
Can I install Windows from Command Prompt without a bootable USB?
No, you can’t. The Command Prompt method relies on a pre-made bootable USB drive with the Windows ISO. Think of it as your "installation key"—without it, the process won’t start. Always create a bootable USB first using tools like Rufus or Media Creation Tool.
How long does it take to install Windows via Command Prompt?
Timing varies, but expect 30–60 minutes for a clean install on a standard PC. Factors like hardware speed (SSD vs. HDD), ISO size, and system resources play a role. Pro tip: Close unnecessary programs and ensure your USB drive is plugged in securely to avoid delays.
What if the Command Prompt won’t recognize my USB drive?
This usually happens if the USB isn’t properly formatted or isn’t detected. First, check if the drive appears in Disk Management (press Win + X > Disk Management). If it’s missing, try a different USB port or reformat it as FAT32 or NTFS using diskpart commands. Need help? Run diskpart > list disk > select disk X > clean > create partition primary > format fs=fat32 quick (replace X with your USB’s number).
Is there a safer alternative to Command Prompt installation?
If you’re uncomfortable with Command Prompt, try these user-friendly methods:
- Windows Setup GUI: Boot from the USB and follow the on-screen installer (no CMD needed).
- Third-party tools: Use Media Creation Tool or Windows 11 Installation Assistant for automated setups.
- Autounattend.xml: For advanced users, this script automates the process—just configure it and place it in the USB’s
\sourcesfolder.
Will this method wipe my entire hard drive?
Yes, unless you customize the installation. By default, the Command Prompt method erases all data on the target drive. To preserve files, back them up first or use the diskpart commands to create a new partition instead of formatting the entire disk. Warning: Double-check your disk letters in CMD to avoid accidental data loss!
Can I install Windows on a virtual machine (VM) via Command Prompt?
Not directly—Command Prompt installation requires a physical boot. However, you can:
- Mount the Windows ISO in the VM and run the installer manually (no CMD needed).
- Use
bcdbootordismcommands after the VM is set up with a pre-installed OS.
Wrapping up and next steps
You’ve now mastered the art of installing Windows via Command Prompt—what a power move! 🚀 Whether you’re troubleshooting an old PC, setting up a new system, or just flexing your tech skills, this method gives you full control.
Remember, patience and precision are your best tools, especially when dealing with bootable media and partitions.
Ready to take it further? Explore advanced customization—like tweaking Windows settings post-install or diving into automated scripts for batch installations. The command line is your playground! 💻✨
