computing
  • 1

Solved Batch File To Set Registry Values As Variables

  • 1

I am trying to find a way to store a registry key value in a variable to use it later.

For example: some data in a value is a full path to an executable file that I want to delete from my hard disk. So if I can store it as a variable I can use it on a DEL command and delete it.

Seems REG QUERY can do it in some way, but it returns too much trash. Here’s another example.

If I use

REG QUERY “HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run” /v AlcoholAutomount

It returns to me

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
AlcoholAutomount REG_SZ “C:\Program Files (x86)\Alcohol Soft\Alcohol 120\AxAutoMntSrv.exe”

I just want the part “C:\Program Files (x86)\Alcohol Soft\Alcohol 120\AxAutoMntSrv.exe”, which is the data of the AlcoholAutomount value.

Any clues?

Share