Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exporting registry key and SETing the string

Status
Not open for further replies.

Roeee

IS-IT--Management
Jul 31, 2002
110
0
0
GB
Apologies if this is the wrong forum for the type of request.

I am attempting to export a registry string (REGEDIT /e or REG QUERY .logfile) to a text file and would like to specify the result as a SET variable. The problem is that the output text file has several lines of text rather than the required string (as such I can not select SET = field3 for example).

Is there any command I can use to output only the specified string? If not, is there a quick way I can select a registry string and SET as a variable for use within a batch file?

Thanks
 
not sure if im going to answer your question, but this sounds like something i wrote awhile back. i wrote a batch file to export the Un-Install string for installed apps on users pc's...i would have like to call the apps uninstall .msi file but the guid was different on each pc, so i exported the reg key that was unique to each pc.here it is:
REGEDIT /E :NEWFILE.reg "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\YOUR-APP-HERE"

FOR /F "TOKENS=1* delims==" %%A in ('TYPE c:NEWFILE.reg ^| FIND ":"') DO SET UI1=%%B
SET LINE1=%UI1:\\=\%
SET LINE1=%LINE1:\"="%
SET LINE1

FOR /F "DELIMS=" %%A IN ('%LINE1%') DO ECHO %%A

del "c:NEWFILE.reg" /q

What it does is exports the reg key. then finds the line of the key that has a ":" in it and sets it to UI1. then it removes the double backslashes \\, then changes any = to a \. Next it calls %Line1%, which is the un-install string, and it un-installs the app. then it will delete the .reg file it created.

Hope this Helps
chris castelein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top