Hello everyone,
since I need to install a powerpoint add-in without prompting messages I need to create a batch file to realise it.
First of all, my problem is that I don't know the commands to do what's in my mind. I hope you can help me out!
Problem:
I want to get the value of a registry key and put in into a variable first. I don't know how to get the final output into my variable.
When i put in 'reg query "HKEY_CLASSES_ROOT\Word.Application\CurVer"' for which the output is
(Standard) REG_SZ Word.Application.15 (those must be all parts of the key)
I want to save the "15" in a variable and after that concatenate it with two other strings (a wrap around) to combine all of those to a registry path file which i want to use.
However i dont know how to realise this, hopefully you can help me!
Kind regards
Put a registry key in variable and split it up!
Moderator: DosItHelp
-
- Posts: 4
- Joined: 12 Jan 2018 11:31
- Contact:
Re: Put a registry key in variable and split it up!
Code: Select all
for /F "skip=1 tokens=3 delims=." %%G IN ('reg query "HKEY_CLASSES_ROOT\Word.Application\CurVer" /ve') do set ver=%%G
-
- Posts: 4
- Joined: 12 Jan 2018 11:31
- Contact:
Re: Put a registry key in variable and split it up!
Thanks Squashman! But what is my variable name then? and how can i concatenate it with two other strings?
-
- Posts: 4
- Joined: 12 Jan 2018 11:31
- Contact:
Re: Put a registry key in variable and split it up!
Is that code correct?
I want to create two keys in the registry to make powerpoint automatically load my add in. To keep the code dynamic i want to get the powerpoint version and afterwards concatenate it with the variables a and b which i wrap around to create a string that contains the registry path.
Code: Select all
for /F "skip=1 tokens=3 delims=." %%G IN ('reg query "HKEY_CLASSES_ROOT\PowerPoint.Application\CurVer" /ve') do set ver=%%G
SET a="HKEY_CURRENT_USER\Software\Microsoft\Office\"
SET b=".0\PowerPoint\AddIns\MyAddIn"
SET path=%a%%%G%b%
REG ADD %path% /v "AutoLoad" /t REG_DWORD /d 1 /f
REG ADD %path% /v "Path" /t REG_SZ /d AddIn.ppam /f
Last edited by aGerman on 13 Jan 2018 05:51, edited 1 time in total.
Reason: code formatting
Reason: code formatting
-
- Posts: 4
- Joined: 12 Jan 2018 11:31
- Contact:
Re: Put a registry key in variable and split it up!
I still couldn't figure it out. It also says that the "reg" command is invalid