TriPPiN Posted September 14, 2006 Share Posted September 14, 2006 (edited) Hi, I am making my unattended Win XP Pro Setup and I have been trying to find a way to reboot into safe mode to finish installing certain files. I want this to happen automatically after setup finishes and then pick up where it left off. In safe mode it should automatically install a few files then reboot back into normal mode and be finished.I have searched my a** off for a command line switch to reboot into safe mode on xp like u can for 95/98 but to no avail.My recent failed attempt involved using the utility included in xp pro called BOOTCFG.exe.It worked partly by rebooting and then entering safemode but I have no idea to pick up the script or another script after in safe mode.Here is the beginning of the script..@echo offECHO.ECHO REBOOTING INTO SAFE MODEECHO.bootcfg /raw /a /safeboot:minimal /id 1SHUTDOWN -r -f -t 01This script must be ran before rebooting or every boot will be in safe-mode:bootcfg /raw /fastdetect /id 1SHUTDOWN -r -f -t 01ANY HELP WOULD BE GREATLY APPRECIATED.. I AM AT A DEAD END Edited September 15, 2006 by TriPPiN Link to comment Share on other sites More sharing options...
mazin Posted September 15, 2006 Share Posted September 15, 2006 Thank you for sharing the code of rebooting into Safe Mode.I didn't know it's that easy. Link to comment Share on other sites More sharing options...
TriPPiN Posted September 15, 2006 Author Share Posted September 15, 2006 Still need help with this if anyone has the knowledge or the "drive" to figure this out.. Feel free to do so. Link to comment Share on other sites More sharing options...
mazin Posted September 16, 2006 Share Posted September 16, 2006 It's easy! I just wanted to know the reboot code. Link to comment Share on other sites More sharing options...
pmshah Posted September 16, 2006 Share Posted September 16, 2006 (edited) I use a utility called change.com to change the default time out from 30 seconds to 10 seconds in boot.iniWith the same utility I can also add the following line ...multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Safe Mode" /fastdetect /safeboot:minimal /sos /bootlogto get option of safe boot. If This is placed as the first choice it will automatically boot to safe mode. Edited September 16, 2006 by pmshah Link to comment Share on other sites More sharing options...
IcemanND Posted September 16, 2006 Share Posted September 16, 2006 the only thing I have ever seen that will run automatically on boot into safe mode are the runonceex registry keys. anything else would have to be run manually. Link to comment Share on other sites More sharing options...
mazin Posted September 16, 2006 Share Posted September 16, 2006 RunOnceEX does not work, here! Link to comment Share on other sites More sharing options...
RogueSpear Posted September 16, 2006 Share Posted September 16, 2006 I had a computer boot into safe mode unintentionally and it still ran my RunOnceEx scripts (which failed due to the unavailability of WMI). I wonder why it would work for some and not others?Also, just in case it would be of use to anybody here, I've used a freeware utility for booting into safe mode that works pretty nice: BootSafe Link to comment Share on other sites More sharing options...
TriPPiN Posted September 17, 2006 Author Share Posted September 17, 2006 (edited) Thanks for the responses so far yet the resolution is still a mystery. Pmshah: That utility serves no more purpose than "bootcfg.exe" included with WinXP Pro.... The extra switches you used are unnecessary.Roguespear: I happened to find "Bootsafe" before this post and it doesn't have a switch for silent use.If the RunOnceEx key works during safe mode then I will have my solution by simply changing my script to the following:RebootScript@ECHO OFFregedit /s c:\progs.regbootcfg /raw /a /safeboot:minimal /id 1SHUTDOWN -r -f -t 01Progs.regWindows Registry Editor Version 5.00[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx]"Reboot-Normal"="bootcfg /raw /fastdetect /id 1""Script2"="c:\\SafeModeScript.cmd"SafeModeScript.cmd@ECHO OFFStart notepad.exeStart wordpad.exeSHUTDOWN -r -f -t 01 Edited September 18, 2006 by TriPPiN Link to comment Share on other sites More sharing options...
mazin Posted September 17, 2006 Share Posted September 17, 2006 I've run a careful test for the following 10 run points.The first two run points have been executed in safe mode.The rest of run points have been executed after rebooting in normal mode.The table maintains the order they have been executed.:===========:=============::-CMD from--:--SAFE MODE--::===========:=============::-1-LM-ROEX-:-----YES-----::-----------:-------------::-2-CU-ROEX-:-----YES-----::-----------:-------------::-3-LM-RO---:-----NO------::-----------:-------------::-4-LM-POL--:-----NO------::-----------:-------------::-5-LM-RUN--:-----NO------::-----------:-------------::-6-CU-POL--:-----NO------::-----------:-------------::-7-CU-RUN--:-----NO------::-----------:-------------::-8-STRTP-A-:-----NO------::-----------:-------------::-9-STRTP-U-:-----NO------::-----------:-------------::10-CU-RO---:-----NO------::-----------:-------------:Abbreviations:LM-ROEX=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceExCU-ROEX=HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnceEXLM-RO=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceLM-POL=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer\RunLM-RUN=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunCU-POL=HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer\RunCU-RUN=HKCU\Software\Microsoft\Windows\CurrentVersion\RunSTRTP-A="%AllUsersProfile%\Start Menu\Programs\Startup"STRTP-U="%UserProfile%\Start Menu\Programs\Startup"CU-RO=HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce Link to comment Share on other sites More sharing options...
Yzöwl Posted September 17, 2006 Share Posted September 17, 2006 (edited) I once posted here on these boards a reboot to safe mode `compiled` batch file.It ran a key in LM RunOnce for the revert to normal mode on next boot, so I know that LM RunOnce works everytime, (when you know how).<Edit>Here's the attachment from the said post</Edit> Edited September 17, 2006 by Yzöwl Link to comment Share on other sites More sharing options...
TriPPiN Posted September 18, 2006 Author Share Posted September 18, 2006 Just tested the RunOneEx theory and it didn't work. Nothing that I put in either hklm or hkcu runoneex started up. The script that I wrote earlier would work perfectly if I could find a way to start a program at boot for safemode.Also one more note.. when it reboots, a box comes up verifying if you want to enter safemode or not.. a method to bypass this box needs to be found for "silent" installation. Link to comment Share on other sites More sharing options...
mazin Posted September 19, 2006 Share Posted September 19, 2006 (edited) I think you haven't used ROEX the correct way.Please make another attempt using the following outlines.@ECHO OFFECHO Rebooting into Safe ModeSET LMROEX=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceExREG ADD %LMROEX% /V TITLE /D "LM-ROEX SafeMoe" /fREG ADD %LMROEX%\101 /vE /d "SafeMoe Installs" /fREG ADD %LMROEX%\101 /v 1 /d %SystemDrive%\SafeModeScript.cmd /fbootcfg /raw /a /safeboot:minimal /id 1SHUTDOWN -r -f -t 01Don't use your Progs.reg!@ECHO OFFECHO Safe Mode InstallsStart notepad.exeStart wordpad.exeECHO Rebooting into Normal Modebootcfg /raw /fastdetect /id 1SHUTDOWN -r -f -t 01 Edited September 19, 2006 by mazin Link to comment Share on other sites More sharing options...
Takeshi Posted September 19, 2006 Share Posted September 19, 2006 mazin has a point about the progs.reg, it is incorrect.Just wonder what it is that HAS to be installed/run in Safe Mode. Link to comment Share on other sites More sharing options...
TriPPiN Posted September 19, 2006 Author Share Posted September 19, 2006 Success!!! This issue is now resolved!With the help of (mazin) I have solved this mystery and programs can be run in safe mode automatically during windows setup. I reduced the code to one batch file that works perfectly on Windows XP. This batch must be run as the LAST install on windows setup!@ECHO OFF:: CHANGE PROG* TO INSTALLER/S BEING USEDSET PROG1=notepad.exeSET PROG2=calc.exe:: DON'T CHANGE THIS STUFF!SET LMROEX=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceExSET A=bootcfg /raw /fastdetect /id 1SET B=bootcfg /raw /safeboot:minimal /id 1SET C=SHUTDOWN -r -f -t 01REG ADD %LMROEX%\Installers /ve /d "SafeMode Installs" /fREG ADD %LMROEX%\Installers /v 1 /d "cmd /c start /w /min cmd /c %PROG1%" /fREG ADD %LMROEX%\Installers /v 2 /d "cmd /c start /w /min cmd /c %PROG2%" /fREG ADD %LMROEX%\Normal /ve /d "Exiting Safe Mode" /fREG ADD %LMROEX%\Normal /v 1 /d "%A%" /fREG ADD %LMROEX%\Normal /v 2 /d "%c%" /f%B%%c%exitThanks for the help MAZIN. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now