Shutdown.exe Fails?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Dos_Probie
Posts: 233
Joined: 21 Nov 2010 08:07
Location: At My Computer

Shutdown.exe Fails?

#1 Post by Dos_Probie » 15 Feb 2011 09:34

The below batch works in turning off the UAC and says "The operation completed successfully" then just stops there and won't do the shutdown command. I am sure it something simple that I am overlooking but any help would be most appreciated. P.S. also specified dos color will not work as well... :(



@echo off&setlocal&color 0c&mode con: cols=75 lines=20
title [ Disable User Account Control - Windows 7 ]

:Suppress UAC consent prompt dialog to "Never notify"
"%windir%\system32\cmd.exe" /k "%windir%\system32\reg.exe add hklm\software\microsoft\windows\currentversion\policies\system" /v EnableLUA /t reg_dword /d 0 /f
"%windir%\system32\cmd.exe" /k "%windir%\system32\reg.exe add hklm\software\microsoft\windows\currentversion\policies\system" /v ConsentPromptBehaviorAdmin /t reg_dword /d 0 /f

shutdown.exe -f -r -t 0&endlocal&exit

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Shutdown.exe Fails?

#2 Post by aGerman » 15 Feb 2011 12:09

Why do you use "%windir%\system32\cmd.exe" /k ?
This should work:

Code: Select all

reg add "hklm\software\microsoft\windows\currentversion\policies\system" /v EnableLUA /t reg_dword /d 0 /f

Regards
aGerman

Dos_Probie
Posts: 233
Joined: 21 Nov 2010 08:07
Location: At My Computer

Re: Shutdown.exe Fails?

#3 Post by Dos_Probie » 15 Feb 2011 16:39

Thanks! aGerman that did the trick , also noticed if I used the /c switch instead of the /f that it would contintue on then reboot ..

Post Reply