Welcome to Tech Support Forum home to more then 136,000 problems solved. Issues have included: Spyware, Malware, Virus Issues, Windows, Microsoft, Linux, Networking, Security, Hardware, and Gaming Getting your problem solved is as easy as:
1. Registering for a free account
2. Asking your question
3. Receiving an answer

Registered members:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* See fewer ads.
* And much more..

 



Want to know how to post a question? click here Having problems with spyware and pop-ups? First Steps
Go Back   Tech Support Forum > The IT Pro > Programming
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read


Programming A discussion forum for programs and programming used in tech-related businesses.

Reply
 
LinkBack Thread Tools
Old 05-31-2009, 04:15 PM   #1 (permalink)
Registered User
 
Join Date: Aug 2007
Posts: 120
OS: windows xp


program to remove "windows is now running in safe mode"

hey guys,

i'm not sure whether this belongs here or not.

i work in a computer repair shop. lately, in my spare time, i've been writing a batch file that does a lot of the work we would do when repairing virus related issues. at one point, the batch file puts itself into the "run once" part of the registry, and reboots into safemode, to repair permissions. however, i forgot that on xp machines there is a message that pops up that says "xp is now running in safe mode." this is pretty annoying because the whole point of the batch file is to allow me or one of my coworkers to leave the computer to do its own thing.

does anyone know of any command i could add to my batch file that would get rid of this message temporarily? maybe there's some kind of registry edit i could do and then undo?

any help would be appreciated.
jash is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Important Information
Join the #1 Tech Support Forum Today - It's Totally Free!

TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free.

Join TechSupportforum.com Today - Click Here

Old 05-31-2009, 05:13 PM   #2 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,854
OS: Vista, various linux distros


Re: program to remove "windows is now running in safe mode"

Pretty sure it's written into the packaged drivers so removing the actual message is an effort. You could however use some form of macro language to rid of the message once it's running, then maybe compile it and throw it into the start of your batch file for SM. May i suggest throwing together an AutoHotkey/AutoIt script to step up from batch to a macro language? (Google the names, AutoHotkey is easier to use for this sort of thing)...

Other than that all i can think of is checking out msconfig.exe and under the boot section seeing if there's a message surpression thing? Godknows to be honest but i think it's there to stay, so a work around is the way i'd go about it.

Cheers,
Jamey
__________________

Myspace
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-31-2009, 05:33 PM   #3 (permalink)
Registered User
 
Join Date: Aug 2007
Posts: 120
OS: windows xp


Re: program to remove "windows is now running in safe mode"

that's a great idea actually.

i don't know much about using these scripts though so i'm not really sure how to do it. also, that message is the first thing to come up, and, if i remember correctly, i don't think the machine will finish loading xp until "yes" is hit on the message. would i run into the same problem with the script here as i did with my batch file?
jash is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-31-2009, 06:13 PM   #4 (permalink)
Registered User
 
Join Date: Aug 2007
Posts: 120
OS: windows xp


Re: program to remove "windows is now running in safe mode"

http://www.pctools.com/guides/registry/detail/214/

i found that while doing some research, but it looks like it only supports older versions of windows, and i need xp and vista.
jash is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-31-2009, 06:18 PM   #5 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,854
OS: Vista, various linux distros


Re: program to remove "windows is now running in safe mode"

Okay, well autohotkey's site has a brilliant getting started which will cover this through and through, obvious advantages are, ability to add gui, in depth file commands, pre-programmed routines to work with complex strings/files/reg info/whatever else. But yes, i've seen the wall that's hit there. Though i've found a solution, i can't test it myself because i'm running vista(eww), but it's one that will do the job: http://www.pctools.com/guides/registry/detail/214/

Give it a go and get back.

Cheers,
Jamey

Edit: we hit that link at the same time
__________________

Myspace
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-31-2009, 06:26 PM   #6 (permalink)
Registered User
 
Join Date: Aug 2007
Posts: 120
OS: windows xp


Re: program to remove "windows is now running in safe mode"

hahaha that's the link i just posted! it looks like it doesn't even work in xp.
by the way, i know that vista comes up with a similar message, but does it not allow you to do anything until responding to it?

so far my batch file works in xp and vista, i don't want to lose that.
jash is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-31-2009, 06:28 PM   #7 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,854
OS: Vista, various linux distros


Re: program to remove "windows is now running in safe mode"

I've never seen the same message in vista =S godknows why that is, but it's just not popped up before, i remember the message from XP though.
I guess it's probably to do with limiting automated access (Basically because if someone can screw with you in safe mode they've got you at the core)... I'm going to keep looking for a solution, but i doubt it will be an easy one.

Cheers,
Jamey
__________________

Myspace
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-31-2009, 06:33 PM   #8 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,854
OS: Vista, various linux distros


Re: program to remove "windows is now running in safe mode"

Have you tried going through MSConfig to boot in safe mode minimal/CommandPrompt(i think it might not throw the message when you use CP[honestly don't remember])/the different versions of safe mode?

Cheers,
Jamey
__________________

Myspace
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-31-2009, 06:39 PM   #9 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,854
OS: Vista, various linux distros


Re: program to remove "windows is now running in safe mode"

Alright, i'm off to bed, but tomorrow i'll hae a play about with my XP machine and see if i can work this out (it has become an "i must do this" sort of puzzle thing). Sure it's do-able.
__________________

Myspace
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-31-2009, 06:41 PM   #10 (permalink)
Registered User
 
Join Date: Aug 2007
Posts: 120
OS: windows xp


Re: program to remove "windows is now running in safe mode"

awesome. thanks so much dude.
jash is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-31-2009, 08:05 PM   #11 (permalink)
Registered User
 
Join Date: Aug 2007
Posts: 120
OS: windows xp


Re: program to remove "windows is now running in safe mode"

so i found that by booting into safe mode with an alternate shell, this message doesn't come up. this is because the alternate shell is the command prompt in stead of explorer.exe. when i did this, i found that the "run once" registry key won't run in safe mode! that is unless for some reason explorer.exe needs to be running. so now i think, i can boot into safe mode without the message coming up, but i can't start the batch file!

heres a copy of the batch file that is supposed to run the program i want to run in safe mode.

------------------------------------------------
@echo off
start notepad.exe start.txt
control userpasswords2
pause Echo. Press any key to begin myprogram
copy myprogram.lnk C: (this is to copy a shortcut of myprogram to the c drive)
reg add HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce /v myprogram /t REG_SZ /d C:\myprogram.lnk /f > nul

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(alternateshell)" (
Echo Safe mode detected.
Goto runnormalmode
) Else (
Echo Normal mode detected.
Goto runsafemode
)
Goto end

:runsafemode
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(alternateshell)
Echo. Your PC is now set to start in Safe Mode.
attrib C:\boot.ini +h +r +s
Goto end

:runnormalmode
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=

Shutdown -r

---------------------------------
userpasswords2 is used to remove the need for a password when logging in, so it doesn't require any touch time half way through.

start.txt is just some instructions on what to do in userpasswords2


any ideas?

Last edited by jash; 05-31-2009 at 08:07 PM.
jash is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 06-01-2009, 01:40 AM   #12 (permalink)
TSF Enthusiast
 
TheOutcaste's Avatar
 
Join Date: Mar 2009
Location: Portland, OR
Posts: 815
OS: MS-Dos 6.22 - Win7


Re: program to remove "windows is now running in safe mode"

Put the path and name of your batch file here:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor
in the AutoRun string. This is usually null, but you may want to save it first. It may not be present.

Code:
Reg Export "HKLM\SOFTWARE\Microsoft\Command Processor" C:\HKLMCP.txt
Reg Add "HKLM\SOFTWARE\Microsoft\Command Processor" /v AutoRun /T REG_SZ /d "C:\Scripts\Test.cmd" /F
This will be executed every time you start a Command Prompt
When finished in safe mode, before rebooting, restore the previous key:

Code:
Reg Delete "HKLM\SOFTWARE\Microsoft\Command Processor" /F
Reg Import C:\HKLMCP.txt
Del C:\HKLMCP.txt
HTH

Jerry
__________________
Microsoft MVP - Windows Desktop Experience
Of course I know all the answers; I just don't always match the answers to the right questions.
Rated R for Violence -- When your PC flies through a window, that's violent, right?
TheOutcaste is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 06-01-2009, 04:21 AM   #13 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,854
OS: Vista, various linux distros


Re: program to remove "windows is now running in safe mode"

I think Jerry has the answer there. Good luck getting everything working.

Cheers,
Jamey
__________________

Myspace
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 06-01-2009, 04:42 PM   #14 (permalink)
Registered User
 
Join Date: Aug 2007
Posts: 120
OS: windows xp


Re: program to remove "windows is now running in safe mode"

i really want to be able to use the program no matter where it's been placed on the machine. is that possible?
jash is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 06-02-2009, 05:34 AM   #15 (permalink)
TSF Enthusiast
 
TheOutcaste's Avatar
 
Join Date: Mar 2009
Location: Portland, OR
Posts: 815
OS: MS-Dos 6.22 - Win7


Re: program to remove "windows is now running in safe mode"

Quote:
Originally Posted by jash View Post
i really want to be able to use the program no matter where it's been placed on the machine. is that possible?
[quote=TheOutcaste;2166272]Put the path and name of your batch file here:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor
in the AutoRun string./QUOTE]

Just specify the path to the batch file.
__________________
Microsoft MVP - Windows Desktop Experience
Of course I know all the answers; I just don't always match the answers to the right questions.
Rated R for Violence -- When your PC flies through a window, that's violent, right?
TheOutcaste is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 06-02-2009, 10:54 AM   #16 (permalink)
Registered User
 
Join Date: Aug 2007
Posts: 120
OS: windows xp


Re: program to remove "windows is now running in safe mode"

oh i see. can i use the batch file to create a shortcut on say, the root so that it doesn't matter where i place the program? i know how to copy files, but i don't know any way to make shortcuts.
jash is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 06-02-2009, 11:12 AM   #17 (permalink)
Registered User
 
Join Date: Aug 2007
Posts: 120
OS: windows xp


Re: program to remove "windows is now running in safe mode"

anyway i tried it and got "Error: invalid key name"

haha i feel like i'm doing something stupid

---------------------------

@echo off
start notepad.exe start.txt
control userpasswords2
pause Echo. Press any key to begin superJ
Reg Export C:\"system analyzer"\superJ.bat C:\HKLMCP.txt
Reg Add C:\"system analyzer"\superJ.bat /v AutoRun /T REG_SZ /d "C:\Scripts\Test.cmd" /F

pause
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 runnormalmode
) Else (
Echo Normal mode detected.
Goto runsafemode
)
Goto end

:runsafemode
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(alternateshell)
Echo. Your PC is now set to start in Safe Mode.
attrib C:\boot.ini +h +r +s
Goto end

:runnormalmode
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=

Shutdown -r

Last edited by jash; 06-02-2009 at 11:16 AM.
jash is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 06-03-2009, 01:22 PM   #18 (permalink)
Registered User
 
Join Date: Aug 2007
Posts: 120
OS: windows xp


Re: program to remove "windows is now running in safe mode"

bump please
jash is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 06-04-2009, 07:22 PM   #19 (permalink)
TSF Enthusiast
 
TheOutcaste's Avatar
 
Join Date: Mar 2009
Location: Portland, OR
Posts: 815
OS: MS-Dos 6.22 - Win7


Re: program to remove "windows is now running in safe mode"

Quote:
Originally Posted by jash View Post
Reg Export C:\"system analyzer"\superJ.bat C:\HKLMCP.txt
Reg Add C:\"system analyzer"\superJ.bat /v AutoRun /T REG_SZ /d "C:\Scripts\Test.cmd" /F
Guess I could have worded that a bit better. The path and name of the file should replace the sample path and name I used ("C:\Scripts\Test.cmd"), not the keyname.
The format for Reg Export is:
Reg Export <keyname> <filename>

<Keyname> in this case is "HKLM\SOFTWARE\Microsoft\Command Processor"
Filename is anything you chose, my example used C:\HKLMCP.txt.
This is just to save the current registry settings. Note that this won't work on Vista as you can't create files in the root of the drive

The format for Reg Add is:
Reg Add <keyname> /V <valuename> /T <type> /D <data> /F

<Keyname> in this case is "HKLM\SOFTWARE\Microsoft\Command Processor"
<valuename is AutoRun
<type> is REG_SZ
Data is the name of the file you want to run: "C:\system analyzer\superJ.bat"
The /F forces an overwrite if the AutoRun key already exists.
The parts in red must be exactly as shown. The parts in blue you change to fit your filenames.
So use this and only change the parts in blue as needed:
Code:
Reg Export "HKLM\SOFTWARE\Microsoft\Command Processor"                    C:\HKLMCP.txt
Reg Add "HKLM\SOFTWARE\Microsoft\Command Processor" /v AutoRun /T REG_SZ /d                    "C:\system analyzer\superJ.bat" /F
The Reg Export and Reg Add commands should be in the runsafemode section. You configure boot.ini to boot to safe mode, and configure the registry to run the superj.bat file.
When the system reboots to safe mode, the superj.bat file is run. When that file finishes, it needs to remove the registry entry and reconfigure the boot.ini file to boot to normal mode.
I'm assuming the superj.bat file is not the one you've posted. If it is, then this part:
Code:
start notepad.exe start.txt
control userpasswords2
pause Echo. Press any key to begin superJ
should be in the runsafemode part, or it will also be displayed when the system reboots to safe mode. No need to repeat the instructions or bring up the User Accounts applet.

To restore the registry and clean up, you'd use these three commands:
Reg Delete "HKLM\SOFTWARE\Microsoft\Command Processor" /V AutoRun /F
Reg Import C:\HKLMCP.txt
Del /F C:\HKLMCP.txt

You first delete the AutoRun key in case one did not previously exist, then import the settings you saved.

HTH

Jerry
__________________
Microsoft MVP - Windows Desktop Experience
Of course I know all the answers; I just don't always match the answers to the right questions.
Rated R for Violence -- When your PC flies through a window, that's violent, right?
TheOutcaste is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 06-08-2009, 02:44 PM   #20 (permalink)
Registered User
 
Join Date: Aug 2007
Posts: 120
OS: windows xp


Re: program to remove "windows is now running in safe mode"

thanks for the more detailed post. i'll give that a try tonight.
i was running the user accounts applet was so the machine was so that when the machine rebooted a user did not need to be selected, and the machine would just go right past the welcome screen.
jash is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -7. The time now is 06:05 AM.



Copyright 2001 - 2009, Tech Support Forum
Home Tips Plus | Outdoor Basecamp | Automotive Support Forum

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85