Jump to content

regread/copy?


 Share

Recommended Posts

Is it possible to read the path of a registry and copy it? Or navigate to the path and copy it?

Im thinking along with lines of trying to copy the folder acra control.

 

The path is as such: "HKEY_LOCAL_MACHINESOFTWAREACRA CONTROL""

ive only got this at the moment:

$var =  RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\ACRA CONTROL", "")
    MsgBox(4096, "DEMO", $var)

    DirCopy($var, $destinationPath, 1)
Edited by olo
Link to comment
Share on other sites

Doesn't seem to be much wrong with your code, other than you may need to provide a key instead of the empty quotes?

Unless of course, the default from RegRead is the actual path you want?

i.e. something like Install_path ... but it could be anything really

$var =  RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\ACRA CONTROL", "Install_path")

Or a path may not even have been specified in that part of the Registry?

Not really all that sure on the actual question you are in reality asking though.

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

Debug RegRead by checking what @error and @extended return.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Yea was trying to copy a reg_sz file to place it somewhere else.

But I dont think its possible since its default and has no data value set.

So I think ill have to automate it graphically.

Link to comment
Share on other sites

  • Moderators

If you're looking for a specific key, regardless of the value, why not do a reg export?

Run("Reg Export HKLM\BCD00000000\Description C:\Myreg.reg")

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

 

If you're looking for a specific key, regardless of the value, why not do a reg export?

Run("Reg Export HKLM\BCD00000000\Description C:\Myreg.reg")

Wow that looks perfect. Didnt know such a thing existed. I was focusing on finding a regcopy or something similar along those lines. Cheers man

Can you expand on the line of code a little bit.

The above stores the export where? Or is it stored in the clipboard?

Also if my key is default.

I presume I will have something like :

Run(" Reg Export HKEY_LOCAL_MACHINE\SOFTWARE\ACRA CONTROL\Default.reg")
Edited by olo
Link to comment
Share on other sites

Reg.exe is a built in Windows program to handle registry operations.

 

 
REG EXPORT KeyName FileName [/y]
 
  Keyname    ROOTKEY[subKey] (local machine only).
    ROOTKEY  [ HKLM | HKCU | HKCR | HKU | HKCC ]
    SubKey   The full name of a registry key under the selected ROOTKEY.
 
  FileName   The name of the disk file to export.
 
  /y       Force overwriting the existing file without prompt.
 
Examples:
 
  REG EXPORT HKLMSoftwareMyCoMyApp AppBkUp.reg
    Exports all subkeys and values of the key MyApp to the file AppBkUp.reg
 

 

The second parameter is the file name. There is not an option to export only a single value as you are suggesting. You can do this a couple ways. The way we are going so far goes like this:

1. Export the reg key to a file

2. Read the file and find the relevant information

3. Use our relevant information

Additionally , you can use variables to store the value in memory (much faster and easier IMO):

1. RegRead the value that you want - store the output into a variable:

$Variable = RegRead("HKLM\Software\MySoftware", "MyValue")

2. Use that info to make a new key somewhere else:

RegWrite("HKLM\Software\MySoftware2", "MyValue", "REG_SZ", $Variable)

EDIT: I just saw that you mentioned the data was empty. So you should not even have to read the key to copy it, just check if it exists using RegRead and then write out your empty value to your new location. So the above changes to:

RegRead("HKLM\Software\MySoftware", "MyValue)
If @error Then ConsoleWrite("Error: " & @error & @CRLF)

RegWrite("HKLM\Software\MySoftware", "MyValue", "REG_SZ", "")
Edited by 0xdefea7
Link to comment
Share on other sites

The screenshot just shows regedit being open on a specific key.

If you are trying to write the contents of that entire key, including subkeys, then the first method would be the way to go.

1. Output to a file using the "Reg Export" command

2. Open the file - See FileOpen in the help file

3. Make the changes that you want - see StringReplace in the helpfile

4. Write the changes and close the file - see FileClose

5. Run("reg import <thenewfileyoujustmodified>.reg")

Please see my edited post above as well in case that helps

Link to comment
Share on other sites

The screenshot just shows regedit being open on a specific key.

If you are trying to write the contents of that entire key, including subkeys, then the first method would be the way to go.

1. Output to a file using the "Reg Export" command

2. Open the file - See FileOpen in the help file

3. Make the changes that you want - see StringReplace in the helpfile

4. Write the changes and close the file - see FileClose

5. Run("reg import <thenewfileyoujustmodified>.reg")

Please see my edited post above as well in case that helps

Yea you see that default in the screenshot? That is included in the ACRA Control folder on the left side.

I want to export that ACRA control folder.

Link to comment
Share on other sites

  • Moderators

olo, as has been an issue in some of your other threads - we are happy to help, but you need to do some work for yourself. I gave you an example of exporting a reg key, and 0xdefea7 even posted the /? output of the REG EXPORT command. It is up to you to read the documentation given, and come to understand why things work the way they do. You want it to save somewhere else, read through the documentation to figure out which piece saves the file, and try some different options on your own. We can only do so much :)

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

olo, as has been an issue in some of your other threads - we are happy to help, but you need to do some work for yourself. I gave you an example of exporting a reg key, and 0xdefea7 even posted the /? output of the REG EXPORT command. It is up to you to read the documentation given, and come to understand why things work the way they do. You want it to save somewhere else, read through the documentation to figure out which piece saves the file, and try some different options on your own. We can only do so much :)

No no thats perfectly fine. I read and do everything else.

After you posted your line I asked if you could expand on it. As in explain the parameters in your line of code. AS I found nothing in the help file....   :)

Edited by olo
Link to comment
Share on other sites

 

Then the answer was already here in this thread - JLogan3o13 already answered it. Here is it changed so that it outputs to your desktop:

Opt("ExpandEnvStrings", 1)
Run('reg export "HKLM\Software\MySoftware" "%userprofile%\desktop\test.reg"')

Thank you and I appreciate what you did. I was aware he gave the answer I just asked for him to expand on what he wrote as I could find no reference to it in the help file.

Link to comment
Share on other sites

The Run command is external to AutoIt, you wont' find it in the help file. But I'll bet you could find it on Google.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • Moderators

The Run command is external to AutoIt, you wont' find it in the help file. But I'll bet you could find it on Google.

 

You mean REG command is external to AutoIt, right? :)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Oops, yeah, I meant to say what was being Run was external to autoit, not that the run command was. Bad wording on my part.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

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...