sodcalculator

10 Tech How-To

Install Windows 10 from Command Prompt: Full Guide

Guide 10-51837 · Updated · Step by step

Yes, you can install Windows 10 from the Command Prompt, though the phrase usually means one of two things: launching the graphical setup from a command line, or performing a fully automated installation using a script. This guide covers both methods, including how to create a bootable USB, run setup.exe with switches, and use an answer file for hands-off installation.

Understanding the Two Approaches

When people search for installing Windows 10 from Command Prompt, they typically mean one of these:

  • Launching Setup.exe with command-line switches – You run the Windows 10 installer from an existing Windows session or from the WinPE environment, adding flags to control the process (e.g., /auto upgrade for an in-place upgrade).
  • Fully automated installation using an answer file – You create an autounattend.xml file that answers every setup question, then run Setup from the command prompt, which reads the file and installs without further input.

There is no direct command that installs Windows 10 without any installer files – you still need the Windows 10 ISO or installation media. The command prompt simply drives the existing installer.

Prerequisites: What You Need

Before you start, gather the following:

  • A Windows 10 ISO file or a bootable USB drive with Windows 10 setup files.
  • A PC that meets Windows 10 minimum requirements (1 GHz processor, 1 GB RAM for 32-bit or 2 GB for 64-bit, 16 GB free disk space).
  • If you’re doing a clean install, back up any data on the target drive – the process will erase it.
  • Administrator rights on the current system if you’re running setup from within Windows.

You can download the official Windows 10 media creation tool from Microsoft’s website to create a bootable USB. That tool is the most reliable way to get the installation files.

Method 1: Using setup.exe with Command-Line Switches

If you already have Windows running and want to upgrade or reinstall while keeping files, you can launch the installer from Command Prompt. Here’s how:

  1. Mount the Windows 10 ISO (double-click it) or insert your USB drive. Note the drive letter (e.g., D:).
  2. Open Command Prompt as Administrator. To do this, press Win, type cmd, right-click “Command Prompt” and choose “Run as administrator”.
  3. Navigate to the setup folder on the media. For example, if your USB is E:, type E: and press Enter, then cd \ to go to the root.
  4. Run the setup with switches. The most common are:
    • setup.exe /auto upgrade – Performs an in-place upgrade, keeping your files and apps.
    • setup.exe /clean install – Forces a clean install (but this switch is not officially documented for all versions; the safer way is to use an answer file).
    • setup.exe /quiet – Suppresses most UI, but still shows progress.
    • setup.exe /noreboot – Prevents automatic restart after installation.
  5. Press Enter and the installer will start. Follow the on-screen prompts unless you use an answer file.

Note: The /auto upgrade switch is supported in Windows 10 and works well for upgrading from Windows 7, 8, or 10. For a clean install, you’re better off booting from the USB and using an answer file.

Method 2: Fully Automated Install with an Answer File

This is the closest thing to a one-command install. You create an autounattend.xml file that answers every setup question (language, partition, product key, etc.). Then you run setup from the command prompt, and it proceeds without any clicks.

Here’s a simplified process:

  1. Create the XML file. You can use Windows System Image Manager (part of the Windows Assessment and Deployment Kit) or write it manually. A minimal file includes the basic Windows settings, disk configuration, and the product key (if you have one).
  2. Place the file at the root of your USB drive or in the same folder as setup.exe.
  3. Boot from the USB. When the Windows Setup screen appears, press Shift+F10 to open a command prompt.
  4. Type setup.exe /unattend:autounattend.xml and press Enter.

The installer will read the file and perform the installation without further input. This method is used by IT professionals to deploy Windows to many machines.

Writing a correct answer file is not trivial – a small syntax error can cause the setup to fail or hang. If you’re not familiar with XML, consider using the Windows ADK to generate one.

Common Problems and How to Fix Them

Here are the most frequent issues people run into when trying to install from command prompt:

  • “Setup.exe is not recognized” – You’re not in the right directory. Double-check the drive letter and path. If your USB is E:, type E: and then cd \.
  • “Windows cannot find Microsoft Software License Terms” – This usually happens when the ISO is corrupted or the file is not fully copied. Re-download the ISO or recreate the USB.
  • Setup starts but then reboots and loops – Often due to a faulty answer file or an incompatible driver. Try without the answer file first, or remove the USB after the first reboot.
  • Command prompt closes immediately – If you’re running from within Windows, you may need to run as Administrator. Right-click and select “Run as administrator”.
  • “Windows cannot install to this disk” – The disk might be GPT or MBR and the BIOS mode doesn’t match. Check if your system uses UEFI or Legacy BIOS and format the disk accordingly.

Choosing Between Clean Install and Upgrade

When you install from command prompt, you have two main paths:

  • Clean install – Wipes the hard drive and installs a fresh copy. This is best if you want to remove bloatware, fix system errors, or change hard drives. You’ll need to back up your files and reinstall all programs.
  • In-place upgrade – Keeps your files, settings, and most applications. This is faster and less disruptive, but it doesn’t fix deep-rooted system problems. Use the /auto upgrade switch for this.

If you’re using the answer file method, you can specify in the XML whether to wipe the disk or keep existing partitions. The DiskConfiguration section controls this. For a clean install, set WillWipeDisk to true.

Safety and Precautions

Installing an operating system is risky if you’re not careful. Follow these safety rules:

  • Back up your data – A clean install will erase everything on the target drive. Even an upgrade can fail and leave your system in a bad state.
  • Use genuine installation media – Download the ISO from Microsoft’s official website. Third-party ISOs may contain malware or be modified.
  • Check your product key – If you have a Windows 10 license, the setup will ask for it. You can skip it during installation and enter it later, but you’ll need it to activate.
  • Ensure stable power – A power outage during installation can corrupt the system. Use a laptop with a charged battery or connect to a UPS.
  • Do not interrupt the process – Once setup starts, let it run. Interrupting can leave your system unbootable.

Frequently Asked Questions

Can I install Windows 10 from Command Prompt without a USB?
Yes, if you already have Windows running and you have the ISO file on your hard drive. Mount the ISO and run setup.exe from the command prompt. You don’t need a USB for an in-place upgrade, but for a clean install you’ll need to boot from something – either a USB or a DVD.

What does the /auto upgrade switch do exactly?
It tells setup to perform an in-place upgrade, preserving your files, settings, and installed applications. It’s the same as running the setup normally and choosing “Keep personal files and apps”. This switch is useful for automating the upgrade process.

How do I open a command prompt during Windows setup?
When the Windows Setup screen appears (usually the first blue screen with language options), press Shift+F10. This opens a command prompt with administrative privileges, allowing you to run setup commands or repair tools.

Is it possible to install Windows 10 using only commands, without any graphical interface?
Not really. The Windows 10 installer is a graphical application. Even when you run setup.exe from the command prompt, it launches the GUI. For a truly text-based installation, you’d need to use Windows PE (Preinstallation Environment) and apply a custom image with DISM, which is more advanced.

Can I use the command prompt to install Windows 10 on a new SSD?
Yes. Connect the SSD, boot from your Windows 10 USB, open the command prompt with Shift+F10, and use diskpart to prepare the disk (clean, create partition, format). Then run setup.exe or use an answer file that targets the new disk.

Why does my command prompt say “access denied” when I run setup.exe?
You’re not running as administrator. If you’re in Windows, right-click Command Prompt and choose “Run as administrator”. If you’re in the Windows Setup command prompt (Shift+F10), you already have admin rights, so the issue is likely that the file is on a read-only medium or the path is wrong.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →