Sign in to follow this  
Followers 0
Logman

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

9 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

I tried to run a compiled exe including a GUI in the recovery console and it works.

Edited by Logman

Share this post


Link to post
Share on other sites

Is explorer.exe process running in the Recovery Console?

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Is explorer.exe process running in the Recovery Console?

No, explorer.exe is not running.

Edited by Logman

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

The Win PE shell of setup is winpeshl.exe, not explorer.exe

There are only a few processes running, run taskmgr from the recovery prompt.


I see fascists...

Share this post


Link to post
Share on other sites

Yes, that's it! In the recovery console:

explorer.exe ... is not running

setup.exe ... is running

winpeshl.exe ... is running

It will be sufficient to verify that recovery console is running.

Thanks

Share this post


Link to post
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
Sign in to follow this  
Followers 0