Jump to content

How to check that a script is run from Windows Recovery Console?


 Share

Recommended Posts

I wrote a batch script (bat) designed for Windows Recovery Console (SHITF + F10 after boot from DVD), which automatically moves the Users and ProgramData folder to another drive and then create a junction link (mklink) to target destinations.

But if I want to use system restore via restore point I have to boot from DVD again, start the Windows Recovery Console, and both linked folder move back to system drive...

Batch script is very uncomfortable and I plan to rewrite it to AutoIt (it will not be a problem), but I need advice...

How to check that AutoIt script (EXE) is executed from the Windows Recovery Console? Is there a way how to check that Windows is(not) loaded? (I do not know if it is appropriate to check if process explorer.exe exists...)

Edited by Logman
Link to comment
Share on other sites

I planned to check is process explorer.exe exists, but for moving the system folders like ProgramData and Users I want to use at least one other method for check is script is running only in recovery console.

For example, after boot to a safe mode with command prompt the process explorer.exe is not running too, but in this mode, you cannot move the system folders. This is the main reason why I asked for a different method.

I use robocopy to move both folders and if the OS is loaded the robocopy.exe reports an error, but some files and folder are already moved.

I forgot to write that my OS is a Windows 7 64-bit

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...