Windows
Installing Windows from the command prompt feels like cheating—no GUI, just raw power. ⚡ I first did this back in 2003 when my uncle’s IBM desktop refused to recognize a USB drive, and the same principles still work today.
The command line gives you control over every step, from partitioning disks to kicking off the installer, but it demands precision. One wrong character, and you’ll be staring at a "bad command or file name" error for hours.
You’ll need three things: a legitimate Windows ISO (verified with SHA-256 checksums), a bootable USB drive formatted as FAT32, and admin access to your target machine.
My go-to method uses diskpart to clean and partition the USB, then bootsect to inject the Windows bootloader—though modern UEFI systems might need extra tweaks. The whole process takes about 20 minutes if you’ve prepped your ISO correctly, but rushing here is how people brick their systems.
I’ve seen it happen more times than I’d like to admit.
Once your USB is ready, you’ll boot into the command prompt and run setup.exe /auto with the right parameters to skip the UI entirely. This method shaves off minutes during deployment, especially when setting up multiple machines. The trade-off?
You’ll miss the progress bar’s false sense of security. For troubleshooting, bcdedit becomes your best friend—it reveals hidden boot configuration issues that the installer would normally hide behind a "Windows could not prepare the computer" error.
Not every scenario needs this level of control. If you’re just reinstalling Windows on a single machine, the GUI installer is simpler. But for sysadmins managing fleets of PCs or recovering from a corrupted boot sector, the command line is the only way.
Here’s how to make it work without pulling your hair out.
📚 In This Guide
- What you need
- Instructions
- Tips and common mistakes
- Wrapping up and next steps
What you need
- ● Windows ISO file: Download the official Windows 11/10 ISO (64-bit recommended). Size: ~4-5GB.
- ● USB flash drive (8GB+): A blank or erasable USB (FAT32 formatted). Pro tip: Use a spare drive—this will be wiped!
- ● Computer with Command Prompt access: A PC running Windows (or another OS with diskpart support).
- ○ Rufus or Windows Media Creation Tool: For creating the bootable USB (optional if using diskpart manually).
- ● External monitor/keyboard: If installing on a headless system (e.g., a server).
- ● Ethernet cable: For stable internet during setup (if needed).
- ● Backup software: To safeguard important files before wiping the drive.
Step-by-step instructions for creating a Windows bootable USB via Command Prompt
Here's the straightforward method I use to create a bootable Windows installer.
💻 Step 1: Prepare Your USB Drive and Download Windows Media
First, insert your 8GB or larger USB flash drive into your computer. I always use a drive with at least 8GB capacity—Windows 11 requires this minimum for the installation files. Open File Explorer and note the drive letter assigned to your USB (usually E: or F:).
Download the Windows 11 or Windows 10 ISO from Microsoft’s official site. Save it to your Downloads folder or a convenient location. You’ll need this file for the next steps. Make sure the ISO is the latest version—older builds may not include critical updates.
⌨️ Step 2: Open Command Prompt as Administrator
Press Win + X on your keyboard and select Terminal (Admin) or Command Prompt (Admin). If prompted by UAC, click Yes to grant administrative privileges. This is critical—running Command Prompt without admin rights will fail the disk formatting process.
In the Command Prompt window, type diskpart and press Enter. A new window will open showing the DISKPART prompt. This utility lets you manage disk partitions directly from the command line. You’ll use it to clean and format your USB drive.
🔧 Step 3: Clean and Format the USB Drive
At the DISKPART prompt, type list disk and press Enter. A list of all connected disks will appear. Identify your USB drive by its size—it should match the capacity of the drive you inserted. Note the Disk number (e.g., Disk 1).
Type select disk X (replace X with your USB drive’s number) and press Enter. Then type clean and press Enter to erase all existing data. Confirm by typing create partition primary and format fs=fat32 quick. This prepares the drive for bootable media. Wait 30-60 seconds for formatting to complete.
💡 Step 4: Mount the ISO and Copy Installation Files
Back in the Command Prompt (Admin), type mount followed by the path to your downloaded ISO (e.g., mount D:\path\to\windows.iso). This mounts the ISO as a virtual drive. Note the drive letter assigned to the mounted ISO—it will appear in File Explorer.
Now, type xcopy followed by the source (mounted ISO drive) and destination (USB drive letter) paths. For example: **xcopy D:\sources\* E:\ /E /F /H /C. This copies all files, including hidden and system files, to your USB. Wait 5-10 minutes for the process to finish—don’t interrupt it.
⏰ Step 5: Verify the USB and Boot from It
After copying completes, type exit to close DISKPART and Command Prompt. Eject the USB drive safely, then reinsert it. Open File Explorer and check that the USB contains the sources, setup.exe, and boot folders—these confirm the files copied correctly.
Restart your computer and enter the BIOS/UEFI (usually by pressing F2, F12, DEL, or ESC** during boot). Set the USB as the first boot device, save changes, and exit. The Windows installer should now launch automatically.
Tips & tricks for creating a Windows bootable USB via Command Prompt
Here's what I've learned after creating dozens of these USBs—these tricks save time and prevent headaches.
Double-Check Your USB Drive: Before you start, verify your USB drive's capacity is at least 8GB—Windows 11 absolutely requires this minimum. I've seen people waste hours formatting drives that were too small. Also, make sure you've backed up any important files since Step 3's "clean" command will erase everything on the drive permanently.
Admin Rights Are Non-Negotiable: I can't stress this enough—running Command Prompt without admin privileges will fail the disk formatting process every single time. If you get stuck here, try pressing Win+X again and selecting "Command Prompt (Admin)" specifically. Some systems require you to right-click the Start menu and choose "Windows Terminal (Admin)" if the default shortcut doesn't work.
Timing Tip for File Copying: Those 5-10 minutes during the xcopy process might seem long, but don't interrupt it! I've seen people think their computer froze because nothing appears to be happening. The command is silently copying all files including hidden system files—this is normal. If you're impatient, you can open File Explorer and watch the files appear in real-time on your USB drive.
BIOS Boot Order Shortcut: When you restart to boot from USB, most modern systems will show a boot menu by pressing F12 during startup. This is often faster than entering BIOS settings. If you're unsure which key to press, check your motherboard manual or look for a message like "Press F12 for boot menu" during startup. I keep a sticky note on my monitor with the boot menu key for my specific system.
Pro Tips for Install Windows From Command Prompt
- Here's what I've learned after creating dozens of these USBs—these tricks save time and prevent headaches.
- Double-Check Your USB Drive: Before you start, verify your USB drive's capacity is at least 8GB—Windows 11 absolutely requires this minimum.
- Admin Rights Are Non-Negotiable: I can't stress this enough—running Command Prompt without admin privileges will fail the disk formatting process every single time.
Frequently asked questions
Got questions about installing Windows via Command Prompt? You’re not alone! Below are answers to the most common queries—from timing to troubleshooting—to help you breeze through the process with confidence.
Can I install Windows from Command Prompt without a bootable USB?
No, you can’t install Windows directly from Command Prompt alone. The Command Prompt method requires a pre-made bootable USB or DVD with the Windows ISO. Think of it as a "remote control"—you need the actual installation media to start the process.
How long does it take to install Windows via Command Prompt?
The installation time varies, but here’s a rough breakdown:
- Prep time (creating bootable media): 10–30 minutes (depends on ISO size and USB speed).
- Actual installation: 20–60 minutes (faster SSDs or HDDs may take longer).
- Post-install setup: 5–15 minutes (drivers, updates, personalization).
Pro tip: Close unnecessary apps and use a wired connection to speed things up!
What if the Command Prompt method fails during installation?
If the process stalls or errors out, try these fixes:
- Reboot and re-enter the Command Prompt with
diskpartto clean the target drive ( Warning: This erases all data!). - Verify your USB is bootable using
bootsect /nt60 X:(replaceXwith your USB drive letter). - Use the Media Creation Tool as a fallback for a standard GUI install.
Still stuck? Check Microsoft’s official forums for model-specific solutions.
Is there a way to install Windows without Command Prompt?
If Command Prompt feels too technical, try these alternatives:
- GUI Installer: Download the Media Creation Tool and use the step-by-step wizard.
- Unetbootin: A third-party tool to create bootable USBs with a user-friendly interface.
- Rufus: A lightweight app for advanced USB customization (supports UEFI, NTFS, etc.).
For beginners, the GUI method is the easiest and most foolproof!
Will this method work for dual-boot setups?
Yes, but you’ll need to:
- Partition your drive using
diskpartbefore installation. - Select the correct partition during setup (not the system reserved space).
- Configure boot options in BIOS/UEFI to choose between OSes.
Pro tip: Shrink your existing partition first to make space—use shrink volume in Disk Management.
Wrapping up and next steps
Installing Windows via the Command Prompt might sound intimidating, but with the right steps, it’s a powerful and efficient way to refresh your system. You now know how to create a bootable USB, access the Command Prompt, and kickstart the installation—all without needing a GUI.
This method is perfect for advanced users or IT pros looking for speed and control.
Ready to take the next step? Test your bootable USB on a secondary machine first to ensure everything works smoothly. Once you’re confident, dive into customizing your Windows setup or explore other Command Prompt tricks to master your system like a pro! 🚀
