Results 1 to 6 of 6

Thread: [RESOLVED] Naming .REG file Help Please

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Location
    Ft. Worth, Texas
    Posts
    67

    Resolved [RESOLVED] Naming .REG file Help Please

    Hi All! I'm new to programing and VB ( Well, did do a bit of batch file work back in the bad ol' day of DOS!).

    Anyway, I need some help with the following.

    I'm working on a program to export a registry key and save the .REG file. Right now it saves the file to a specific path and file name. The part I need help with is having the user name the file. It would still be saved to the specific path. I was thinking about calling a form with a text box where the user would input the filename (except the ".REG" which would be hard coded.) and click on a button to save the file.

    (BTW- This will be running from a thumb drive. Thus the relative path.)

    Right now the code I'm using is this (short & simple!):

    VB Code:
    1. 'Registry Key Backup - This Works.
    2. Private Sub cmdBackup_Click()
    3. 'This will export the registery info from (HKEY_LOCAL_MACHINE\Software\MyApp\IIP\Option)
    4. 'to the app.path
    5. Shell "regedit /e ./Backups/OptionKeys.reg HKEY_LOCAL_MACHINE\Software\MyApp\IIP\Option"
    6. Call MsgBox("The Option Key backup has been saved.    ", vbOKOnly + vbInformation + vbApplicationModal + vbDefaultButton1, "FILE SAVE")
    7. End Sub

    Thanks for any help & suggestions!

  2. #2
    Member
    Join Date
    Nov 2006
    Posts
    43

    Re: Naming .REG file Help Please

    I write a relative path like you, maybe you have to change it in order to make it work.

    VB Code:
    1. Name "..\Backups\OptionKeys.reg" as "..\Backups\" & user_specified_filename & ".reg"

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Location
    Ft. Worth, Texas
    Posts
    67

    Re: Naming .REG file Help Please

    Quote Originally Posted by Ericson
    I write a relative path like you, maybe you have to change it in order to make it work.

    VB Code:
    1. Name "..\Backups\OptionKeys.reg" as "..\Backups\" & user_specified_filename & ".reg"
    When I did this:

    VB Code:
    1. Shell "regedit /e ./Backups/OptionKeys.reg HKEY_LOCAL_MACHINE\Software\MyApp\IIP\Option"
    2. Name "..\Backups\OptionKeys.reg" As "..\Backups\" & user_specified_filename & ".reg"

    It gives a "Compile Error - Variable Not Defined." For "user_specified_filename"

    ??

  4. #4
    Member
    Join Date
    Nov 2006
    Posts
    43

    Re: Naming .REG file Help Please

    I made that one up, you should replace it with the variable containing the filename the user specified.

    If the user put a filename in the textbox text1 then it should look like this:
    VB Code:
    1. Name "..\Backups\OptionKeys.reg" As "..\Backups\" & text1.text & ".reg"

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Location
    Ft. Worth, Texas
    Posts
    67

    Re: Naming .REG file Help Please

    Quote Originally Posted by Ericson
    I made that one up, you should replace it with the variable containing the filename the user specified.

    If the user put a filename in the textbox text1 then it should look like this:
    VB Code:
    1. Name "..\Backups\OptionKeys.reg" As "..\Backups\" & text1.text & ".reg"
    DOH! I'll try that.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Location
    Ft. Worth, Texas
    Posts
    67

    Re: Naming .REG file Help Please

    Worked!! Thanks!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width