Jump to content

SAFE MODE


piyush pathak

Recommended Posts

Hi members,

I just want to place a entry in the 'Start Menu' for 'safe boot' option. So that I can restart my WINDOWS-XP in safe mode without pressing F8 or without going to Boot menu option.

PLEASE NOTE THAT I DON'T WANT TO USE ANY SOFTWARE FOR THIS.

Help in this regard will be appreciated.

THANKS.

Edited by piyush pathak
Link to comment
Share on other sites


Well you can add a safe mode option to your boot menu so you can get into the safe mode without pressing F8.

Press Windows + R to open the Run command.

Type attrib C:\boot.ini -s -h -r

Press Enter.

Press Windows + R again

Type notepad C:\boot.ini

Press Enter.

Now copy paste the last line to a new line and the end of the last line, add /SAFEBOOT:minimal

Also change "Microsoft Windows XP Professional" to something like "XP Safemode" so that you can distinguish between the two choices.

Change the timeout= to the amount of time you want the boot menu to be displayed (default is 30 seconds).

Now when you boot your comp, you'll automatically get two choices, normal and safemode. It'll boot into normal mode by default.

For eg, here's how my boot.ini would look like (may be different from yours so do not copy paste from this)

[boot loader]
timeout=5
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /noexecute=alwaysoff /fastdetect
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="XP Safemode" /noexecute=alwaysoff /fastdetect /safeboot:minimal

Now although this isn't exactly what you wanted, it does the trick. Now if you wanted it on your start menu though, I could write an elaborate .bat file to do it. And it would still qualify under your non-thidparty software requirement.

Link to comment
Share on other sites

Dear deXter,

Thanks for co-operation. please attach bat file for my purpose. please give details how can i pin to start menu & do safe mode from there. If i wish to revert back to normal mode option for the same should be there in the start menu.

please explain in detail.

thank you.

Link to comment
Share on other sites

Well you can add a safe mode option to your boot menu so you can get into the safe mode without pressing F8.

Press Windows + R to open the Run command.

Type attrib C:\boot.ini -s -h -r

Press Enter.

Press Windows + R again

Type notepad C:\boot.ini

Press Enter.

Now copy paste the last line to a new line and the end of the last line, add /SAFEBOOT:minimal

Also change "Microsoft Windows XP Professional" to something like "XP Safemode" so that you can distinguish between the two choices.

Change the timeout= to the amount of time you want the boot menu to be displayed (default is 30 seconds).

Now when you boot your comp, you'll automatically get two choices, normal and safemode. It'll boot into normal mode by default.

For eg, here's how my boot.ini would look like (may be different from yours so do not copy paste from this)

[boot loader]
timeout=5
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /noexecute=alwaysoff /fastdetect
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="XP Safemode" /noexecute=alwaysoff /fastdetect /safeboot:minimal

Now although this isn't exactly what you wanted, it does the trick. Now if you wanted it on your start menu though, I could write an elaborate .bat file to do it. And it would still qualify under your non-thidparty software requirement.

This was a good trick mate

I'm too interested to know how to put it in Start menu...and I will stop using this 3rd-party add on ofcourse :hello:

Link to comment
Share on other sites

@Echo Off

:: StartInSafeMode.bat - by [deXter]
:: Sets Windows XP to boot in Safe Mode / Normal Mode

Echo.

Find "default=" C:\boot.ini > default
For /f "skip=2 tokens=2,3* delims== " %%i IN (default) DO @set default=%%i
For /F "tokens=5,6* skip=4 delims=: " %%i IN (C:\boot.ini) DO @set mode=%%k

If "%mode%" == "/safeboot:minimal" (
Echo Safe mode detected.
Goto setnormalmode
) Else (
Echo Normal mode detected.
Goto setsafemode
)
Goto end

:setsafemode
attrib C:\boot.ini -s -r -h
echo> C:\boot.ini [boot loader]
echo>> C:\boot.ini timeout=30
echo>> C:\boot.ini default=%default%
echo>> C:\boot.ini [operating systems]
echo>> C:\boot.ini %default%="Windows XP Safe Mode" /noexecute=alwaysoff /fastdetect /safeboot:minimal
Echo. Your PC is now set to start in Safe Mode.
attrib C:\boot.ini +h +r +s
Goto end

:setnormalmode
attrib C:\boot.ini -s -r -h
echo> C:\boot.ini [boot loader]
echo>> C:\boot.ini timeout=30
echo>> C:\boot.ini default=%default%
echo>> C:\boot.ini [operating systems]
echo>> C:\boot.ini %default%="Microsoft Windows XP Professional" /noexecute=alwaysoff /fastdetect
Echo. Your PC is now set to start normally.
attrib C:\boot.ini +h +r +s
Goto end

:end
Del default
Set mode=
Set default=

Echo.
Echo. Press [X] to close this window.
Pause > nul

Exit

Copy paste in notepad, save as something.bat

If you want it on your start menu, create a shortcut to it and Pin it up!

This single bat file will toggle between safemode and normal mode. If you want it to reboot your PC automatically too, add a Shutdown -r at the end, before the exit.

Edited by [deXter]
Link to comment
Share on other sites

Dear deXter,

Thanks for the posting .bat file!

I have copied your text (of course with your name for credit!) & made .bat file exactly as you mentioned. After that I ran it, I find that it has changed my boot.ini file as this:

[boot loader]

timeout=30

default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS

[operating systems]

multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows XP Safe Mode" /noexecute=alwaysoff /fastdetect /safemode:minimal

After that change in boot.ini I rebooted but nothing happened! System does not start in safe mode. Please note that I have three partitions on my HDD, namely C,D,E. windows xp is on C drive.

please guide me what is the mistake?

Thanks again!

Link to comment
Share on other sites

Because you asked for it, here's how the bat file works: (I'm posting it here as it maybe useful for others too)

Firstly, this whole file depends on the boot.ini trick. Its something I discovered at Sysinternals, so do have a look there for other lesser-known boot.ini switches.

Secondly, this could have also been done by using the command bootcfg which allows one to query and write the boot.ini values such as the deafult OS, the default switches, etc.

You could use bootcfg in the command shell as follows:

:: This saves the switches to a file called "options"

bootcfg | find "OS Load Options" > options

:: The variable %k will contain safeboot if the boot.ini has been set to safemode

for /f "tokens=2,3* delims== " %i IN (options) do @echo %k

:: The variable %j contains switches other than /safeboot

for /f "tokens=4,5 delims= " %i in (options) do @echo %i %j

Type bootcfg /? at the command promt for more info.

Thirdly, you don't have to do it by bat. Windows also supports a better form of scripting called WSH, which some might find it simpler. (It's definately more powerful though).

However, if you're still interested in Batch file programming, have a look at this Interactive Batch Course.

Plus, you can always have a look at the (very detailed) help for these commands by typing them at the command prompt followed by a /?. For eg, to know how For works, type For /?.

However, there are some undocumented tricks you won't find at these sites or the help files. Tricks like using echo>> filename text as opposed to echo text >> filename and using :: for comments instead of REM.. the list is endless. For more of such undocumented tricks, I suggest having a look at Mr. Tom Lavedas's work.

Link to comment
Share on other sites

I think this post became quite interesting for everyone. In this post anyone who don't like to take pain of making bat file or boot.cfg method can easily download utility linked in second post .

And knowledge hungry people can go deXter way!

Edited by piyush pathak
Link to comment
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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...