Jump to content

Help: need script to prepend string in registry


vglnT

Recommended Posts

I am building an install package so I can distribute a program that I have developed during my internship. There is a registry key that contains a file path, and I would like to prepend something like this: "C:\blah\blah2;".

I have tried just making a .reg file, but I do not believe that I can do what I want with this type of file. I think I may need some type of .bat file, which I have never messed with.

Summary:

I need a script that does this:

key = [HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Application]

string value = getValue("StartUpPath")

value = "C:\blah1\blah2;" + value

setValue("StartUpPath",value)

Thanks in advance for the help, because I am at a loss.

Link to comment
Share on other sites


@vglnT - We really do need you to reply to IcemanND's question.

@allen2 - AutoIT's beauty is in its scripting of GUI stuff, I'd see it as overkill for a simple task doable with built-in tools.

When I say built-in I mean either to the software which builds the installation package, (InstallShield for instance has this feature), or to script it separately using components already part of the end users Operating System.

Link to comment
Share on other sites

  • 2 months later...

vbs script solution

----------------------------------------------------------------------------------------------------------------------------

const HKEY_CURRENT_USER = &H80000001

strComputer = "."

Set StdOut = WScript.StdOut

Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_

strComputer & "\root\default:StdRegProv")

strKeyPath = "Software\Microsoft\Office\11.0\Application"

strValueName = "StartUpPath1"

objReg.GetExpandedStringValue HKEY_CURRENT_USER,strKeyPath,_

strValueName,strValue

strValue1 = "C:\blah1\blah2;" & strValue

objReg.SetExpandedStringValue HKEY_CURRENT_USER,strKeyPath,_

strValueName,strValue1

----------------------------------------------------------------------------------------------------------------------------

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
  • Recently Browsing   0 members

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