Share via

Command line to Boot windows 7 in Safemode with Command prompt

Anonymous
2013-12-20T11:28:03+00:00

Dear Sir,

I want to know what command to use for booting the system (windows7 / XP) in Safe mode with command prompt. I need the command for batch file.

Thanks,

Windows for home | Previous Windows versions | Windows update

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

5 answers

Sort by: Most helpful
  1. Anonymous
    2015-03-28T07:24:53+00:00

    Here is a batch code to reboot to safe mode:

    Echo Off

    REM Check Windows Version

    ver | findstr /i "5.0." > nul

    IF %ERRORLEVEL% EQU 0 goto ver_nt5x

    ver | findstr /i "5.1." > nul

    IF %ERRORLEVEL% EQU 0 goto ver_nt5x

    ver | findstr /i "5.2." > nul

    IF %ERRORLEVEL% EQU 0 goto ver_nt5x

    ver | findstr /i "6.0." > nul

    IF %ERRORLEVEL% EQU 0 goto ver_nt6x

    ver | findstr /i "6.1." > nul

    IF %ERRORLEVEL% EQU 0 goto ver_nt6x

    goto warn_and_exit

    :ver_nt5x

    :Run Windows 2000/XP specific commands here

    ::Runs safe mode with networking

    bootcfg /raw /a /safeboot:network /id 1

    REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /v "*UndoSB" /t REG_SZ /d "bootcfg /raw /fastdetect /id 1"

    SHUTDOWN -r -f -t 07

    goto end

    :ver_nt6x

    :Run Windows Vista/7 specific commands here

    ::Runs safe mode with networking

    bcdedit /set {current} safeboot network

    REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /v "*UndoSB" /t REG_SZ /d "bcdedit /deletevalue {current} minimal"

    SHUTDOWN -r -f -t 07

    goto end

    Echo On

    :warn_and_exit

    echo This OS cannot be determined now.

    2 people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2013-12-21T03:39:13+00:00

    Hi Md.Siddique,I would suggest you to try the following steps in elevated command prompt.Safe mode: bcdedit /set {current} safeboot minimal

    Safe mode with networking: bcdedit /set {current} safeboot network
    If you want to return the computer back to normal mode from safe mode or safe mode with networking, then I would suggest you to run the following command in elevated command prompt.
    bcdedit /deletevalue {current} safeboot
    
    As you are trying to create a batch file and it would be better suited in MSDN development forums.
    http://social.msdn.microsoft.com/Forums/en-US/categories
    

     Please post back the results and we will be happy to assist you further.

    1 person found this answer helpful.
    0 comments No comments
  3. Anonymous
    2013-12-21T12:27:58+00:00

    Md.Siddique,

    A normal user, one who is a member of the user group but not the Administrators group, can only change Windows settings that affect that account alone.  A normal user cannot change anything that affects other users or the system as a whole.

    I therefore do not understand what your aim is.  Why do you want a command that will restart the system in Safe Mode? 

    By the way, the errors you are getting in running those commands given by Vijay look to me to be responses to running the commands in a normal Command prompt.  As Vijay wrote, these commands can only be run in an Elevated Command prompt i.e. a Command prompt which an Admin account has given permission to open.  To open an Elevated Command prompt you can enter cmd in the Start menu search box then right-click on the shortcut that is offered to you & select Run as Admin.

    0 comments No comments
  4. Anonymous
    2013-12-21T12:20:33+00:00

    Md.Siddique,

    Your response prompts another question.  What accounts are you running?

    In any Command prompt, enter this to see a list of the accounts & save the list to your Desktop

    net user >"C:\Users*YourUserName*\Desktop\NetUserList.txt"

    then, for each user name found, run commands in this format [example returns properties for the Built-In Administrator account],

    net user Administrator >"C:\Users*YourUserName*\Desktop\NetUserAdministratorProperties.txt"


    A normal setup would reveal that Administrator & Guest are members of the Administrators group & both accounts are disabled.  You might also have deliberately set passwords for each of these accounts to prevent hackers enabling them & misusing them.  You would normally never use the Administrator account [the Windows 7 Built-In Administrator] unless there was a fault that left you with no choice i.e. there was a technical emergency.  User profiles do get corrupted from time to time & every occasion of using the Administrator account is another tick on the clock towards that essential & irreplaceable account becoming corrupted.

    A normal setup would reveal that each individual using the computer has an account in the Users group.  You would probably also see that your own account is a member of both the Users group & the Administrators group [although this is not essential].

    A reliable setup would reveal that there are also two other Administrators group members that you have created yourself.  These two accounts exist to give Admin permissions for operations such as installations but are not used for any other purpose.  Personally, I alternate giving permissions between these two additional Administrators group accounts in order to test them i.e. I give the permission needed but by this action I am confirming that the account is still functional, that the account has not suffered from user profile corruption.  Because these accounts are used so infrequently, the chances of user profile corruption are low and the chances of both being corrupt at the same time is minimal.  If any account does become corrupted then there is an extremely high probability that at least one of these additional Admin accounts is fully functional and is therefore available for me to sort out the problem.

    A reliable setup would also involve a Password Reset Disk having been made for every account including the Administrator & the Guest accounts.  See also **Precautionary measure 2** - Make & test a Password Reset Disk for every account  [PDF version]

    - - - - - - - - -

    I mention all this because it sounds, from your response, that you are using the Built-In Admin account for routine operations.  This increases the risk that the account succumbs to user profile corruption.  There is no mechanism for replacing the Built-In Admin account other than re-installing Windows 7.

    0 comments No comments
  5. Anonymous
    2013-12-21T07:56:14+00:00

    Hi Mr.Vijay,

    I am getting the following error while typing "bcdedit /set {current} safeboot minimal".

    "The boot configuration data store could not be opened. Access denied."

    Actually, I have disabled the administrator.

    I am using the above command from user login.

    If I manually run the commands (like F8 while booting, enabling the administrator, etc.) the user know how I was enabling/disabling the administrator and its rights.

    The user shouldn't know the process how to do, that's why I want to write a batch file for doing the same.

    I have restrict the desktop (changing of wallpapers) , control panel items, etc.

    If I wanna install any new softwares, etc., I have to enable the administrator.

    kindly give the commands so as to write in the batch file.

    Thanks,

    0 comments No comments