3

I'm trying to automate the Windows 7 Recovery Environment. I want the computer to be able to boot into the Recovery Environment, automatically run some commands, and then restart back into Windows.

The reason for this is that I want to use the Recovery Environment to edit some system files that are not writable while Windows is running. (Of course, this could be done using GRUB and Linux, but it would be even better if one could use the built-in Windows Recovery Environment and avoid the need to install a separate bootloader and OS.)

So far, I've found out how to tell Windows 7 to reboot into the recovery environment:

reagentc /boottore
shutdown /r /t 0

But once the Recovery Environment loads, it opens a dialog that requires user input to continue. Instead of that dialog, I would like to be able to specify a script to run instead.

Any ideas on how to accomplish this would be appreciated. Thanks!

1 Answer 1

3

I know that this is an old question, but I found the answer while looking into this problem myself:

  1. Enter %SYSTEMDRIVE%\Recovery.

  2. If it says access denied:

    image

    ...you shall have to take ownership:

    1. Secondary-click;

    2. Select "Properties";

      image

    3. Select "Security";

      image

    4. Select "Advanced"; then

      image

    5. Select the "Owner" tab, and take ownership.

      image

  3. After this, extract the winre.wim file into a directory, using dism tool in cmd.exe.

  4. Now go into the system32 directory in the extracted WinRE and edit winpeshl.ini.

  5. Remove the launch entry that is already there. This will remove the UI which prompts us to enter a password.

  6. Now, put your script location there instead. Now using dism tool, unmount the extracted directory back into winre.wim.

  7. Now, all you have to do is go into recovery mode, and your script will run without the WinRE startup UI appearing.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .