Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
[green]'==========================================================================
'
' NAME: AddSafeModeBoot.vbs
'
' AUTHOR: Mark D. MacLachlan , The Spider's Parlor
' URL: http://www.TheSpidersParlor.com
' COPYWRITE (c) 2005 All Rights Reserved
' DATE : 2/12/2006
'
' COMMENT: Adds Safe Mode choice to XP boot menu
'
'==========================================================================
' MODIFICATIONS: 2/13/2006 Added support for setting timeout
'==========================================================================[/green]
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("Wscript.Shell")
[green]
'Find the System Drive where Boot.Ini will be found[/green]
Set env = WshShell.environment("Process")
SysDrive = env.Item("SystemDrive")
BootIni = SysDrive & "\boot.ini"
[green]'Remove file ReadOnly, Hidden, System File state[/green]
If objFSO.FileExists(BootIni) Then
WshShell.Run("cmd /c attrib.exe " & BootIni & " -r -h -s")
End If
Set oTextStream = objFSO.OpenTextFile(BootIni)
[green]'make an array from the data file[/green]
BootIniTxt = Split(oTextStream.ReadAll, vbNewLine)
[green]'First check if Safe Mode alredy configured and quit if so.[/green]
For Each line In BootIniTxt
If InStr(1,line,"Safe Mode") Then
WScript.Echo "Safe Mode Already Configured"
LockFile
WScript.Quit
End If
Next
[green]
'OK, Now find where the Windows install is located and add the safe mode line.[/green]
For Each line In BootIniTxt
If InStr(1,line,"timeout") Then
timeArray = Split(line,"=")
timeOut = timeArray(0) & "= " & WaitTime
line = timeOut
End If
If InStr(1,line,"Windows XP") Then
lineArray = Split(line,"=")
SafeModeLine = lineArray(0) & "=" & Chr(34) & "Safe Mode" & Chr(34) _
& " /safeboot:minimal /sos /bootlog"
line = line & vbCrLf & SafeModeLine
End If
Report = Report & line & vbCrLf
Next
[green]
'Open Boot.ini for writing and write new text[/green]
Set ts = objFSO.OpenTextFile (BootIni, ForWriting)
ts.write Report
ts.close
WScript.Sleep 300
LockFile
Sub LockFile[green]
'Return file to previous ReadOnly, Hidden, System File state [/green]
If objFSO.FileExists(BootIni) Then
WshShell.Run("cmd /c attrib.exe " & BootIni & " +r +h +s")
End If
End Sub
Function WaitTime
Answer = InputBox("How many seconds delay would you like to configure for boot selection?" _
& vbCrlf & "Enter only numbers!","Boot Wait?")
If IsNumeric(Answer) Then
WaitTime = Answer
Else
WaitTime
End If
End Function