XtremeMaC Posted March 28, 2004 Share Posted March 28, 2004 see I told u there was powercfg.exe for sp1 I wasn't wrongcause i've been using it. for a sec there i thought i've been using sp2 for a loooong time pfewww.... Link to comment Share on other sites More sharing options...
X-Ecutioner Posted March 28, 2004 Author Share Posted March 28, 2004 WOOOOOOO It works. You guys rock. Thanks again Link to comment Share on other sites More sharing options...
GrimSage Posted May 10, 2004 Share Posted May 10, 2004 ok now the question I have is. How do I change it so that when I close the lid on my computer the computer does not shut down. I dont see how to do this... Link to comment Share on other sites More sharing options...
Snife Posted July 13, 2005 Share Posted July 13, 2005 I thought i would ressurect this old post - i have been having trouble finding a way to set the energy buttons (such as when I close the lid etc) state via command line but unfortunately cannot find any way of doing it as it is one of the few power options not covered in powercfg.Anybody have any ideas yet? Link to comment Share on other sites More sharing options...
jbird123 Posted August 11, 2010 Share Posted August 11, 2010 ok now the question I have is. How do I change it so that when I close the lid on my computer the computer does not shut down. I dont see how to do this...Found this thread while searching for the same thing as you and 'Snife'. If I find a solution I will post it - even though this thread is over 6 years old haha. Maybe NLite has something built in.. Link to comment Share on other sites More sharing options...
uid0 Posted August 11, 2010 Share Posted August 11, 2010 This is something I bodged a while ago - there are probably better ways, and it's been minimally tested on xp 32bit only...' _power.vbsOption ExplicitConst HKCU=&H80000001 Dim WshShell, fso, oReg, strLog, oLogDim temp, userprofileDim sHive, sKey, sValue, oArray, oArrayNewset WshShell = CreateObject("WScript.Shell")Set fso = CreateObject ("Scripting.FileSystemObject")Set oReg=GetObject( "winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv") temp = WshShell.ExpandEnvironmentStrings("%temp%")userprofile = WshShell.ExpandEnvironmentStrings("%userprofile%")strLog = temp & "\_power.txt"if not fso.fileexists(strLog) then fso.CreateTextFile(strLog) end ifSet oLog = fso.OpenTextFile(strLog,8) '8 = ForAppendingIf Wscript.Arguments.Count = 1 Then oLog.WriteLine Now & " " & Wscript.Arguments(0)End IfsHive = HKCUsKey = "Control Panel\PowerCfg\GlobalPowerPolicy" sValue = "Policies"'do nothing when lid is closedalter "52", "off", CInt("&H02")alter "63", "on", CInt("&H80")alter "64", "off", CInt("&H02")alter "75", "on", CInt("&H80")'dont ask for password when resume from standbyalter "172", "off", CInt("&H04")WScript.Quit(0)'byte array is zero basedSub alter (iByte, action, iVal) oReg.GetBinaryValue sHive, sKey, sValue, oArray oArrayNew = oArray select case action case "on" oArrayNew(iByte) = oArray(iByte) OR iVal oReg.SetBinaryValue HKCU, sKey, sValue, oArrayNew oLog.WriteLine Now & " " & iByte & " " & Hex(oArray(iByte)) & " -> " & Hex(oArrayNew(iByte)) case "off" if ((oArray(iByte) AND iVal) = iVal) then oArrayNew(iByte) = oArray(iByte) XOR iVal end if oReg.SetBinaryValue HKCU, sKey, sValue, oArrayNew oLog.WriteLine Now & " " & iByte & " " & Hex(oArray(iByte)) & " -> " & Hex(oArrayNew(iByte)) end select end sub 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