Regedit

J

John

Windows XP Pro with SP3

I created a PwrAlwOn.reg file to set Power Options to Always On. It looks
like the following:

REGEDIT4
[HKEY_CURRENT_USER\Control Panel\PowerCfg]
"CurrentPowerPolicy"="3"

I also cretaed a SetPwr.bat file like the following:
regedit /s PwrAlwOn.reg

I put both files in the \Documents and Settings\All Users\Start
Menu\Programs\Startup

The /s switch is supposed to silently merge the content but that does not
work as expected when users logs on. Users are still prompted. I don't want
them to see any prompts at all. How do I do that?

Thanks.
 
P

Pegasus \(MVP\)

John said:
Windows XP Pro with SP3

I created a PwrAlwOn.reg file to set Power Options to Always On. It looks
like the following:

REGEDIT4
[HKEY_CURRENT_USER\Control Panel\PowerCfg]
"CurrentPowerPolicy"="3"

I also cretaed a SetPwr.bat file like the following:
regedit /s PwrAlwOn.reg

I put both files in the \Documents and Settings\All Users\Start
Menu\Programs\Startup

The /s switch is supposed to silently merge the content but that does not
work as expected when users logs on. Users are still prompted. I don't
want them to see any prompts at all. How do I do that?

Thanks.

What happens when you run the file directly ***after*** logging on, by
copying and pasting this line into the Run box?

cmd /c cd "%AllUsersProfile%\Start Menu\Programs\Startup" & SetPwr.bat

Also: Did you check that there are no other "SetPwr.bat" files floating
about?
 
J

John Wunderlich

John said:
Windows XP Pro with SP3

I created a PwrAlwOn.reg file to set Power Options to Always On.
It looks like the following:

REGEDIT4
[HKEY_CURRENT_USER\Control Panel\PowerCfg]
"CurrentPowerPolicy"="3"

I also cretaed a SetPwr.bat file like the following:
regedit /s PwrAlwOn.reg

I put both files in the \Documents and Settings\All Users\Start
Menu\Programs\Startup

The /s switch is supposed to silently merge the content but that
does not work as expected when users logs on. Users are still
prompted. I don't want them to see any prompts at all. How do I do
that?

Thanks.

You could try dumping the '.reg' file and use the "reg" command in the
..bat file instead of "regedit":

reg add "HKCU\Control Panel\PowerCfg" /v CurrentPowerPolicy /d 3 /f

HTH,
John
 
J

John

Pegasus (MVP) said:
What happens when you run the file directly ***after*** logging on, by
copying and pasting this line into the Run box?

cmd /c cd "%AllUsersProfile%\Start Menu\Programs\Startup" & SetPwr.bat

If I run the batch file after logging on, there is no prompt. I did it by
double clicking the batch file. It goes to dos window and back to Windows in
less than a second.
Also: Did you check that there are no other "SetPwr.bat" files floating
about?

I'm absolutely sure there is no other SetPwr.bat files anywhere else in the
path.
 
J

John

I changed it to REGEDIT5. That does not change the value of
CurrentPowerPolicy. I still see the prompt and I click Yes to import it to
the registry. It says that the registry has been updated (not the exact
message) but nothing gets changed.

Changed it back to REGEDIT4, it works fine but the prompt won't go away.

Bob I said:
Maybe REGEDIT5 instead of 4?
http://support.microsoft.com/kb/310516
Windows XP Pro with SP3

I created a PwrAlwOn.reg file to set Power Options to Always On. It looks
like the following:

REGEDIT4
[HKEY_CURRENT_USER\Control Panel\PowerCfg]
"CurrentPowerPolicy"="3"

I also cretaed a SetPwr.bat file like the following:
regedit /s PwrAlwOn.reg

I put both files in the \Documents and Settings\All Users\Start
Menu\Programs\Startup

The /s switch is supposed to silently merge the content but that does not
work as expected when users logs on. Users are still prompted. I don't
want them to see any prompts at all. How do I do that?

Thanks.
 
J

John

John Wunderlich said:
You could try dumping the '.reg' file and use the "reg" command in the
.bat file instead of "regedit":

reg add "HKCU\Control Panel\PowerCfg" /v CurrentPowerPolicy /d 3 /f

I found out the problem while testing your suggestion. I'm seeing a prompt
because the REG file gets imported twice:

- First, the batch file gets executed (regedit /s PwrAlwOn.reg) - this one
does not prompt

- The second time the .REG file gets called because it is placed in
C:\Documents and Settings\All Users\Start
Menu\Programs\Startup folder

The second execution is the one that causes a prompt to pop up. So I moved
the REG file to the following location: C:\Documents and Settings\All
Users\Documents

Logout then re-login. Voila.. no prompt and the value changes to whatever I
set it to.

Btw, your suggestion works too. I'm going to choose your solution because it
is easier to implement. Thanks much for the tip.
 
J

John Wunderlich

John said:
I found out the problem while testing your suggestion. I'm seeing
a prompt because the REG file gets imported twice:

- First, the batch file gets executed (regedit /s PwrAlwOn.reg) -
this one does not prompt

- The second time the .REG file gets called because it is placed
in C:\Documents and Settings\All Users\Start
Menu\Programs\Startup folder

The second execution is the one that causes a prompt to pop up. So
I moved the REG file to the following location: C:\Documents and
Settings\All Users\Documents

Wow, I didn't see that one coming. Good Catch.
Logout then re-login. Voila.. no prompt and the value changes to
whatever I set it to.

Btw, your suggestion works too. I'm going to choose your solution
because it is easier to implement. Thanks much for the tip.

Yep, Keep it simple.

Glad your problem is explained and solved. Thanks for the feedback.

-- John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top