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 strSaveAndRestoreDir = ExpandPath("%SAR_DIR%","c:\saveAndRestore") strSaveAndRestore = strSaveAndRestoreDir & "\SaveAndRestore.exe" strIniFile = strSaveAndRestoreDir & "\SaveAndRestore.ini" strSarWinIni = strWinFolder & "SaveAndRestore.ini" '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 wshshell.Run("""" & strSaveAndRestore & """",1,True) '------------------------------- 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 Function GetCDDrive() Dim l_Drives Dim l_Drive Dim l_strResult Dim i Set l_Drives = fso.Drives i = 0 On Error Resume Next For Each l_Drive in l_Drives If l_Drive.DriveType = 4 Then l_strResult = l_Drive.Path End If Next GetCDDrive = l_strResult & "\" On Error Goto 0 End Function