Jump to content

Registry operation


Recommended Posts

hello,

 

I have a problem...

I have a registry key (ex HKCU\Software\MyApp)

I have to rename it in HKCU\Software\MyApp_Backup, and then move (from portable) a new RegKey to replace the original one renamed.

After RunWait I have to backup the portable key and rename the old key to original name.

 

in function: https://www.autoitscript.com/autoit3/docs/functions/

I haven't found RegRename, RegMove or similar...

 

How can I reach my goals???

Link to comment
Share on other sites

  • Developers

So what did you find that is possible to manipulate the Registry in the helpfile that also might accomplish what you want?
.... and why exactly do you want this at all? 

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

"and why exactly do you want this at all?"

 

As I have written in my first post, I want create a launcher for portabilize apps, but I have seen until now only basic code...

Like this:

 

RunWait("regedit.exe /s Portable.reg", @ScriptDir)
RunWait("App\talisman.exe")
RunWait('regedit.exe /s /e "' & @ScriptDir & '\Portable.reg" "HKEY_CURRENT_USER\Software\JetCar"')
RunWait("regedit.exe /s Portable2.reg", @ScriptDir)

 

RegDelete Deletes a key or value from the registry.
RegEnumKey Reads the name of a subkey according to its instance.
RegEnumVal Reads the name of a value according to its instance.
RegRead Reads a value from the registry.
RegWrite Creates a key or value in the registry.

 

I have found tools for edit value more than entire keys.

 

Is there a way to realize in AutoIt what I' m looking for?

Link to comment
Share on other sites

  • Developers

There is no move as that is not a standard function , but would think that a RegRead -> RegWrite and then  RegDelete would be the same result ...no? ;) 

... but no options to move keys as far as I know.

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I've thinked at this possibility but there are some problems...

If I write RegRead ""HKCU\Software\MyApp") exit error missing parameter (Value), so I have to read value-by-value the whole key...

And after this I have the problem of change the name of the new key...

 

Any idea or suggestion???

Edited by Grof
Link to comment
Share on other sites

duplicating keys in AutoIt is very possible. it's pretty straightforward

this thread deals with key duplication, you would just add a delete part, and modify the AutoIt code to read/write the correct keys

This next thread deals with basically same thing, save a key to another key, which is closer to your goals I am betting

 

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

What you are trying to do, as it relates to creating portable apps, looks similar to the methodology used by PortableApps.com.  However, they backup a copy of the relevant registry, appdata, and other state and config information to a file structure under the portable app's folder.

As far as backing up or renaming registry keys, you could look into using the REG.EXE command.  As you can see below, it can do everything you have said that you need to do and it comes with Windows.  If it is just a matter of capturing the prior state of the registry, it is probably safer to export the key(s) at launch and import/restore them back upon exit.  The less you mess with the registry, the better.  :)

 

REG Operation [Parameter List]

  Operation  [ QUERY   | ADD    | DELETE  | COPY    |
               SAVE    | LOAD   | UNLOAD  | RESTORE |
               COMPARE | EXPORT | IMPORT  | FLAGS ]

Return Code: (Except for REG COMPARE)

  0 - Successful
  1 - Failed

For help on a specific operation type:

  REG Operation /?

Examples:

  REG QUERY /?
  REG ADD /?
  REG DELETE /?
  REG COPY /?
  REG SAVE /?
  REG RESTORE /?
  REG LOAD /?
  REG UNLOAD /?
  REG COMPARE /?
  REG EXPORT /?
  REG IMPORT /?
  REG FLAGS /?

 

Edited by TheXman
Link to comment
Share on other sites

Thanks to everybody.

I need few time to verify if I can manage this code (I'm a newbie).

Yes, I want create something like PortableApps, or better, NSIS.

 

TheXman, what is Reg.Exe command? Where can I find manuals, guide or tutorial?

Link to comment
Share on other sites

2 minutes ago, Grof said:

TheXman, what is Reg.Exe command? Where can I find manuals, guide or tutorial?

As I said, it comes with Windows.  As far as where you can find more info on it, have you ever heard of Google, Bing, Yahoo, etc.?  :)  You could start by typing "reg.exe /?" in a CMD console or you could look on the Microsoft site, like HERE.

Link to comment
Share on other sites

22 minutes ago, Grof said:

Yes, I want create something like PortableApps, or better, NSIS.

NSIS, as far as I'm aware, creates installers for applications.  It has nothing to do with making an application portable. 

There's even a portable version of NSIS on PortableApps.com:)

Edited by TheXman
Link to comment
Share on other sites

I still use Wraithdu RegFunc UDF (see link below), _RegMoveKey should do what you're after, the UDF also includes RegExport function and a number of other useful registry functions like _RegKeyExists, RegValueExists.

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...