Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Question about Windows Recovery Environment


12 Oct 2010   #1

Windows 7 Ultimate x64
 
 
Question about Windows Recovery Environment

Hi guys, I know that the X:\Windows\system32 from the Recovery Environment has the files WScript.exe and CScript.exe, but can anyone answer if it supports _ALL_ the features of WSH? Namely, I have written a Windows Script that I would use to periodically back up registry hives in the system32\config folder from WinRE:

Code:
Option Explicit
Dim oRegEx, oFSys, datetimeStr, outFile, outContents
Set oRegEx = CreateObject("VBScript.RegExp")
Set oFSys = CreateObject("Scripting.FileSystemObject")
oRegEx.Global = True
oRegEx.Pattern = "[^0-9]"
datetimeStr = oRegEx.Replace(Date() & Time(), Empty)
oFSys.CreateFolder("Backup_" & datetimeStr)
oFSys.CopyFile "SYSTEM", "Backup_" & datetimeStr & "\SYSTEM"
oFSys.CopyFile "SOFTWARE", "Backup_" & datetimeStr & "\SOFTWARE"
oFSys.CopyFile "DEFAULT", "Backup_" & datetimeStr & "\DEFAULT"
oFSys.CopyFile "COMPONENTS", "Backup_" & datetimeStr & "\COMPONENTS"
outContents = "Option Explicit" & vbCrLf & "Dim oRegEx, oFSys, datetimeStr" & vbCrLf & "Set oRegEx = CreateObject(" & Chr(34) & "VBScript.RegExp" & Chr(34) & ")" & vbCrLf & "oRegEx.Global = True" & vbCrLf & "oRegEx.Pattern = " & Chr(34) & "[^0-9]" & Chr(34) & vbCrLf & "datetimeStr = oRegEx.Replace(Date() & Time(), Empty)" & vbCrLf & "Set oFSys = CreateObject(" & Chr(34) & "Scripting.FileSystemObject" & Chr(34) & ")" & vbCrLf & "oFSys.MoveFile " & Chr(34) & "..\SYSTEM" & Chr(34) & ", " & Chr(34) & "..\SYSTEM.BAK." & Chr(34) & " & datetimeStr" & vbCrLf & "oFSys.MoveFile " & Chr(34) & "..\SOFTWARE" & Chr(34) & ", " &  Chr(34) & "..\SOFTWARE.BAK." & Chr(34) & " & datetimeStr" & vbCrLf & "oFSys.MoveFile " & Chr(34) & "..\DEFAULT" & Chr(34) & ", " &  Chr(34) & "..\DEFAULT.BAK." & Chr(34) & " & datetimeStr" & vbCrLf & "oFSys.MoveFile " & Chr(34) & "..\COMPONENTS" & Chr(34) & ", " &  Chr(34) & "..\COMPONENTS.BAK." & Chr(34) & " & datetimeStr" & vbCrLf & "OFSys.MoveFile" & Chr(34) & "SYSTEM" & Chr(34) & ", " & Chr(34) & "..\SYSTEM" & Chr(34) & vbCrLf & "OFSys.MoveFile" & Chr(34) & "SOFTWARE" & Chr(34) & ", " & Chr(34) & "..\SOFTWARE" & Chr(34) & vbCrLf & "OFSys.MoveFile" & Chr(34) & "DEFAULT" & Chr(34) & ", " & Chr(34) & "..\DEFAULT" & Chr(34) & vbCrLf & "OFSys.MoveFile" & Chr(34) & "COMPONENTS" & Chr(34) & ", " & Chr(34) & "..\COMPONENTS" & Chr(34) & vbCrLf & "WScript.Echo " & Chr(34) & "Current COMPONENTS, DEFAULT, SOFTWARE, and SYSTEM hives backed up as *.BAK." & Chr(34) & " & datetimeStr" & vbCrLf
Set outFile = oFSys.CreateTextFile("Backup_" & datetimeStr & "\restore.vbs")
outFile.WriteLine(outContents)
WScript.Echo "Backup of current COMPONENTS, DEFAULT, SOFTWARE, and SYSTEM hives created in folder Backup_" & datetimeStr & "." & vbCrLf & "Use the file Backup_" & datetimeStr & "\restore.vbs while in Windows Recovery Environment to restore this backup."
This works on a live Windows 7 with dummy files, but would this work with registry hives in WinRE?


My System SpecsSystem Spec
.

Reply

 Question about Windows Recovery Environment




Thread Tools




Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 04:44 AM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33