Re: altering the registry
Code:
Imports Microsoft.Win32 'Needed to edit the registry.
'This line navigates to HKEY_CURRENT_USER\Control Panel\Desktop and changes the value of the Key "MYNEWVALUE" to "SomeValueIWantToSave"
'IF "MYNEWVALUE" does not exist it will be created.
Call Registry.SetValue("HKEY_CURRENT_USER\Control Panel\Desktop", "MYNEWVALUE", "SomeValueIWantToSave")
'The next two lines will delete the Key created above.
Dim toDel = My.Computer.Registry.CurrentUser.OpenSubKey("Control Panel\Desktop", True)
toDel.DeleteSubKey("MYNEWVALUE")
Re: altering the registry
Thanks for your reply. Can't I just run the reg script? There is more than one thing I want to change.
Here is one of the scripts i want to run:
This is RWWdev.reg
Code:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\RWW\RaTS]
"ConnStr"="Provider=SQLOLEDB.1;Integrated Security=SSPI;Initial Catalog=RaTSTest;Data Source=sql1.realwinwin.local;"
"ConnStr2"="Provider=SQLOLEDB.1;Initial Catalog=RaTS;Data Source=sql1.realwinwin.local; Uid=rwwRaTS; pwd=RaTS1728;"
"CRPath"=""
"CRYear"="2010"
"CommandTimeout"=dword:00000014
"QB_Interface"=dword:00000001
"QB_TrustBankAccount"="TD Bank, Rebate Trust Acc"
"QB_TrustLiabilityAccount"="Rebate Trust, TD Bank"
[HKEY_LOCAL_MACHINE\SOFTWARE\RWW\RaTS\Project]
"TrackingNumber"="XXXXX"
"StatusId"=dword:00000007
"STCode"="WIPR"
"StatusReasonId"=dword:00000016
"SRCode"="NA"
"MilestoneId"=dword:00000001
"MSCode"="NEW"
"MSDescription"="Project Received by RWW"
"EstFUP"=dword:0000003c
"EstPFD"=dword:0000001e
"AutoDate"=dword:00000001
"EditComments"=dword:00000000
The file is a clickable. It prompts me if I want to change the registry, and after a confirmation, it makes the change.
When I execute this command: WshShell.Run "regedit C:\ListWizard\RatsDBRegistryEntries\RWWdev.reg", 1, True
The same prompt and confirmation occurs. But it doesn't actually change the registry. It says it is in the alert box, but it doesn't.
I don't want to code each one of these into the application. I just want to run this .reg file successfully!
thanks
Re: altering the registry
Don't use shell.... Use Process.Start ...
http://msdn.microsoft.com/en-us/libr....process.start
you'll probably want this specific one...
http://msdn.microsoft.com/en-us/library/h6ak8zt5
the first parameter would the be the app you want to run (regedit.exe) and the second would be commandline parameters to pass to it (/s someregfile.reg)
-tg
Re: altering the registry
This is all getting unnecessarily complicated. To run a .reg file it's ...
Process.Start(YourRegFilePathAndName)
That's it. Everything done.
As for values not 'registering', you did remember that some changes require you to log off and some restart Windows? If there's anything not in place after that then it's the .reg file which is at fault. If Windows said it merged the file then it merged the file.
Re: altering the registry
Thank you all for you help. Problem solved!