The column below was originally published in the June 23, 2016 Windows Secrets.
Today, it supplements a new column, scheduled for the March 11, 2019 AskWoody Plus Newsletter, focused on what to do if an error causes you to lose all admin privileges on your own PC. Click on over to read the new column!
(I’m reprinting selected Windows Secrets columns here to help ensure readers can find and access information I’m referencing in new columns; until older Windows Secrets/LangaList columns are moved to their new home at AskWoody.com.)
The original, verbatim, un-updated text follows:
Using Windows’ powerful ‘Recovery Environment’
By Fred Langa on June 23, 2016 in Best Practices, Top Story
All current versions of Windows offer a built-in, independently bootable command-line environment that you can use for heavy-duty troubleshooting and maintenance tasks.
This specialized system isn’t for everyone; there’s no graphical interface and scant built-in help. But if you’re an experienced user, you might find that this relatively obscure option offers faster and more extensive troubleshooting than more traditional methods — especially when standard Windows won’t boot.
Some of the tasks you can perform include:
- Recovering user files and data from your main drive or drives, even if your regular Windows installation won’t start.
- Doing deep hard-drive maintenance, recovery, or set-up.
- Installing, reinstalling, or modifying Windows.
- Capturing and applying Windows system images.
An offline toolkit for fixing Windows
The Windows Recovery Environment (WinRE) is based on the Windows Preinstallation Environment (WinPE). Both are available in all Windows versions, from Vista onward.
This article is mostly about Win10’s WinRE, but Win8’s is very similar. And many of the concepts also apply to the Win7 and Vista versions. (You’ll find additional general-WinRE/PE information and version-specific details in the references at the end of this article.)
Win10’s WinRE is the home of several functions and features: the stripped-down, bootable, command-line version of Windows that’s the main focus of this article — plus Reset (with “Keep my files” and “Remove everything” options), System Restore, System Image Recovery, and Startup Repair. WinRE also offers a way to change Windows’ startup behavior, and a function to roll the system back to the previous build.
WinRE’s command-line version of Windows might have the look and feel of a standard, desktop command window, but it’s really quite different; it supports a specialized set of tools that are specifically geared towards repair and recovery operations. Because it boots and runs outside of your standard Windows installation, WinRE can be the answer when something truly bad happens to your Windows setup.
For example, WinRE will let you access your PC’s file system when Windows is dead in the water. You can use WinRE’s command interface to run these classic file-management tools (click the links for more MS info): Xcopy, Robocopy, Chkdsk, Diskpartinfo, and DISM.
You can even run System File Checker to repair your main system files, even if they’re scrambled, corrupted, or infected with malware. (Running sfc /scannow [more info] compares your current system files against a source of known-good files — say, on a recovery drive or DVD.)
Running an entirely separate Windows environment
When booted, WinRE sets up a separate and stripped-down version of Windows that lives largely on a temporary RAM drive (definition), typically identified as drive X:. This limited form of Windows usually has the same version number as your main Windows installation, but it has its own machine name — MiniNT. So, again, it’s truly a wholly independent Windows version that temporarily runs alongside the inactive main copy of Windows.
You can see this in Figure 1, which shows the command-line environment of my Win10 PC’s WinRE. The top line shows the RAM disk’s X: designation. I entered ver at the command prompt to show the version number, which is the same number as my main Windows’ version. Next, I typed diskpart to show that this temporary Windows installation identifies my PC as MiniNT — even though my normal setup has a completely different name.
Accessing Win10’s command-based recovery system
There are four main ways to access WinRE in Windows 10 (again, Win8 is very similar; for Win7 and Vista info, see the resources at the end of the article).
- From within Win10: If your normal Windows installation is working, click Start/Settings/Update & security/Recovery; click the Restart now button and in the window that appears, select Troubleshoot/Advanced options/Command Prompt (see Figure 2).
- From recovery medium: If you’ve previously set up a recovery drive or disc (always a good idea; see MS info), boot to that drive or disc, select the correct keyboard layout if prompted, and then select Troubleshoot/Advanced options/Command Prompt.
- From an installation/setup disc or drive: Start your PC from your Windows installation medium (e.g., a DVD, installation drive, or an ISO from the Win10 download page). On the first screen, select your language, time, currency, and keyboard type for your region. On the next screen, click Repair your computer (see Figure 3) and then select Troubleshoot/Advanced options/Command Prompt.
- Automatic start: Windows will normally start the Recovery Environment automatically with certain boot failures; for example: after two consecutive failed attempts to start the main OS, if there are two consecutive unexpected shutdowns that occur within two minutes of boot completion, or after some types of Secure Boot or Bitlocker errors. If prompted, select Troubleshoot/Advanced options/Command Prompt.
However you launch WinRE, you’ll be prompted to choose an account. Select one with administrator privileges and then enter the password for that account.
When the WinRE command window opens, you’ll typically see the command prompt: X:\Windows\System32>(shown in Figure 1). From there, enter standard repair and maintenance commands such as chkdsk, sfc, diskpart,and so forth. You can also use common Windows directory/folder commands to move around the system (e.g., cd to change directory/folder and dir to display the directory/folder contents).
Example: Recover files from unbootable Windows
Again, there are many things you can do within the WinRE command window. For example, here’s how to recover files from an unbootable Windows installation.
Start by booting from your recovery medium or an installation drive/DVD/ISO, as described above.
Once the WinRE command window opens, all your normal drives, folders, and files should be available via the standard command-prompt commands. Note, however, that your primary Windows installation and your associated drives will usually be assigned different drive letters. For example, the standard drive C: might be drive D: within WinRE.
In short, because WinRE’s minimalist Windows installation started from the X: RAM drive, the PC’s other drive letters could be temporarily shuffled around. But they’ll go back to their normal assignments when you exit the WinRE environment.
You can find the new, temporary drive designation for your main Windows installation with just a minute or two of spelunking. Enter different drive letters, working up the alphabet until you find familiar contents. You’ll know you’re in the right place when you find the folder:
{New Temporary Drive letter}:\Users\{your normal Windows username}
For example, at the X:\Windows\System32> prompt, enter C: — this’ll switch you to whatever WinRE currently designates as the C: drive. Enter CD users and press Enter. If you get an error such as “The system cannot find the path specified,” or you enter “dir” and the drive is empty, try the next-higher letter of the alphabet: D:, E:, etc.
(Note: The A: and B: drives are usually reserved for old-style floppy disk operations; you can skip those.)
After switching to the next-higher drive letter, enter cd users again and hit Enter. If you don’t see a folder with your normal Windows user name, move again to the next-higher drive letter.
Repeat the process until you find the folder with your correct user name; you’re now ready to access your files and data.
Use copy, xcopy, move, robocopy, or similar command to move your data to a different location — one that’s off the unbootable system drive.
Figure 4 shows how this worked on my system. I soon found that my C: drive had been (temporarily) reassigned to drive E:.
From e:\Users\Fred, I could easily navigate to my user folders and files — then copy, paste, rename, or do whatever else I might need to do to recover the folders and files.
Complete details are available online
The above example only scratches the surface of what you can do with the Windows Recovery Environment (and the Windows Preinstall Environment on which it’s based). Here are some excellent resources you can use to delve deeper.
Windows Recovery Environment/WinRE:
- “Windows Recovery Environment (Windows RE)” — MSDN
- “Windows RE troubleshooting features” — MSDN
- “Windows Recovery Environment (Windows RE) Overview” — TechNet
- “What is Windows RE?” — TechNet
- “Windows Recovery Environment” — Wikipedia
- “How to Access Windows Recovery Environment in Windows 7” — TechNet
- “Working with Vista’s Windows Recovery Environment” — TechTarget.com
Windows Preinstallation Environment/WinPE:
- “Windows PE (WinPE)” — MSDN
- “What is Windows PE?” — TechNet
- “Download WinPE (Windows PE)” — TechNet
- “Windows Preinstallation Environment” — Wikipedia
Permalink: https://langa.com/?p=2060
COMMENT / QUESTION on THIS ITEM? See the Comment box at bottom of this page!
NEW QUESTION? Ask here!
(Want free notification of new content? Click here!)
1 Reply to “Using Windows’ powerful ‘Recovery Environment’”