Jump to content
Sign in to follow this  
compact21

RegWrite problem Windows 7 x64

Recommended Posts

compact21

Hello, when i try to read or to write a value in the registry nothing happens, no value appears... i tryed this: 

RegWrite("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "TestKey", "REG_SZ", "Hello this is a test")

and this:

RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "TestKey", "REG_SZ", "Hello this is a test")

but none of them works...the return value is 1.

Note: The example script works just like it should, but when i try to read or write a value to Run, it wont work.

Any ideea why?

Thanks!

Share this post


Link to post
Share on other sites
compact21

What is the returncode from RegWrite and the @error value?

Jos

the return code is 0 and the @error value is 1

try #requireadmin in script.

that doesn't work

Share this post


Link to post
Share on other sites
Jos

This works fine for me:

#RequireAdmin
$rc = RegWrite("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "TestKey", "REG_SZ", "Hello this is a test")
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $rc = ' & $rc & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
compact21

This works fine for me:

#RequireAdmin
$rc = RegWrite("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "TestKey", "REG_SZ", "Hello this is a test")
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $rc = ' & $rc & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console

Jos

Thanks alot, that works for me too...any ideea what's the problem with my pice of code?

Share this post


Link to post
Share on other sites
Jos

Thanks alot, that works for me too...any ideea what's the problem with my pice of code?

It is your code with the suggested #RequireAdmin....  that's all ;)


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×