Option Explicit Dim wshshell,fso,i,Fnct Dim strPath,strSystemFolder,strWinFolder,strTempFolder '----------------------------- Objekte erzeugen -------------------------------- i = 0 On Error Resume Next Do err.Clear i = i+1 Set wshshell = CreateObject("WScript.Shell") Set fso = CreateObject("Scripting.FileSystemObject") Set Fnct = CreateObject("Install.Functions") WScript.Sleep 1000 Loop Until Err.Number = 0 OR i > 30 If Err.Number <> 0 Then WScript.Quit End If On Error Goto 0 '--------------------------- Standardpfade ------------------------------------- strPath = GetCurrentPath() strSystemFolder = fso.GetSpecialFolder(1) & "\" strWinFolder = fso.GetSpecialFolder(0) & "\" strTempFolder = fso.GetSpecialFolder(2) & "\" '------------------------------ Main ------------------------------------------- Dim strSaveAndRestore,strSaveAndRestoreDir,strList,strIniFile,strSarWinIni Dim nCount Dim Key strSaveAndRestoreDir = ExpandPath("%SAR_DIR%","c:\saveAndRestore") strSaveAndRestore = strSaveAndRestoreDir & "\SaveAndRestore.exe" strIniFile = strSaveAndRestoreDir & "\SaveAndRestore.ini" strSarWinIni = strWinFolder & "SaveAndRestore.ini" key = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\SaveAndRestore" Call wshshell.RegWrite(Key,strSaveAndRestoreDir & "\saveAndRestore.exe") key = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\Installation" On Error Resume Next wshshell.RegDelete key On Error Goto 0 'strList = "/R" nCount = Fnct.GetIniString("SaveAndRestore","CntEntries",strIniFile) Dim k For k = 1 to nCount strList = strList + Fnct.GetIniString("SaveAndRestore","Entry" & k,strIniFile) If (Int(k) <> Int(nCount)) Then strList = strList + ";" End if Next 'strList = strList + " " & GetCDDrive & "\" Call Fnct.SetInistring("Restart","Profile",strList,strSarWinIni) Call Fnct.SetInistring("Restart","Parameter1",strList,strSarWinIni) Call Fnct.SetIniString("Restart","Parameter2","d:\Temp\SAR",strSarWinIni) Call Fnct.SetIniString("Restart","Restart",1,strSarWinIni) Call Fnct.SetIniString("Restart","Reentry","Restore",strSarWinIni) Call Fnct.ExitWindows(2) '------------------------------- Funktionen ------------------------------------ Function GetCurrentPath() Dim l_strScriptName Dim l_strTemp l_strScriptName = WScript.ScriptFullName l_strTemp = WScript.ScriptName GetCurrentPath = Left(l_strScriptName, Len(l_strScriptName) - Len(l_strTemp)) End Function Function ExpandPath(p_strEnvironment,p_strDefault) Dim l_strTemp l_strTemp = wshshell.ExpandEnvironmentStrings(p_strEnvironment) If l_strTemp = p_strEnvironment Then l_strTemp = p_strDefault End If ExpandPath = l_strTemp End Function