How to change a registry value with a variable in path?
up vote
-4
down vote
favorite
I'd like to change the value "vbawarnings" but the registry path has the word version in it (15.0 or 16.0 or something). So I don't know which word version is insalled on the 5000 computer in our company. I tried this but something went wrong with %%~fA
@echo off
setlocal
set key=HKEY_CURRENT_USERSoftwareMicrosoftOffice
for /f %%A in ('reg query "%key%"') do (
reg add "%key%%%~fAwordsecurity" /t REG_DWORD /v vbawarnings /d 1 /f
)
Any Ideas?
Thank you very much :)
windows microsoft-word windows-registry
add a comment |
up vote
-4
down vote
favorite
I'd like to change the value "vbawarnings" but the registry path has the word version in it (15.0 or 16.0 or something). So I don't know which word version is insalled on the 5000 computer in our company. I tried this but something went wrong with %%~fA
@echo off
setlocal
set key=HKEY_CURRENT_USERSoftwareMicrosoftOffice
for /f %%A in ('reg query "%key%"') do (
reg add "%key%%%~fAwordsecurity" /t REG_DWORD /v vbawarnings /d 1 /f
)
Any Ideas?
Thank you very much :)
windows microsoft-word windows-registry
Can you provide what the value is now in that registry? and what is the type of that registry likeREG_SZ
orREG_EXPAND_SZ
?
– Biswapriyo
Nov 30 at 7:24
Why can’t you just branch the code, if the key exists, the do whatever you need to do for that version of Office. There is at most 5 conditions you would be using. Just use static values, keep it simple, don’t make it harder then it needs to be. The alternative is to determine which versions of Office are deployed.
– Ramhound
Nov 30 at 7:25
this is not only about word, there are some other special programs here with the same problem...
– BenNevis
Nov 30 at 10:58
add a comment |
up vote
-4
down vote
favorite
up vote
-4
down vote
favorite
I'd like to change the value "vbawarnings" but the registry path has the word version in it (15.0 or 16.0 or something). So I don't know which word version is insalled on the 5000 computer in our company. I tried this but something went wrong with %%~fA
@echo off
setlocal
set key=HKEY_CURRENT_USERSoftwareMicrosoftOffice
for /f %%A in ('reg query "%key%"') do (
reg add "%key%%%~fAwordsecurity" /t REG_DWORD /v vbawarnings /d 1 /f
)
Any Ideas?
Thank you very much :)
windows microsoft-word windows-registry
I'd like to change the value "vbawarnings" but the registry path has the word version in it (15.0 or 16.0 or something). So I don't know which word version is insalled on the 5000 computer in our company. I tried this but something went wrong with %%~fA
@echo off
setlocal
set key=HKEY_CURRENT_USERSoftwareMicrosoftOffice
for /f %%A in ('reg query "%key%"') do (
reg add "%key%%%~fAwordsecurity" /t REG_DWORD /v vbawarnings /d 1 /f
)
Any Ideas?
Thank you very much :)
windows microsoft-word windows-registry
windows microsoft-word windows-registry
edited Nov 30 at 11:29
asked Nov 30 at 7:18
BenNevis
11
11
Can you provide what the value is now in that registry? and what is the type of that registry likeREG_SZ
orREG_EXPAND_SZ
?
– Biswapriyo
Nov 30 at 7:24
Why can’t you just branch the code, if the key exists, the do whatever you need to do for that version of Office. There is at most 5 conditions you would be using. Just use static values, keep it simple, don’t make it harder then it needs to be. The alternative is to determine which versions of Office are deployed.
– Ramhound
Nov 30 at 7:25
this is not only about word, there are some other special programs here with the same problem...
– BenNevis
Nov 30 at 10:58
add a comment |
Can you provide what the value is now in that registry? and what is the type of that registry likeREG_SZ
orREG_EXPAND_SZ
?
– Biswapriyo
Nov 30 at 7:24
Why can’t you just branch the code, if the key exists, the do whatever you need to do for that version of Office. There is at most 5 conditions you would be using. Just use static values, keep it simple, don’t make it harder then it needs to be. The alternative is to determine which versions of Office are deployed.
– Ramhound
Nov 30 at 7:25
this is not only about word, there are some other special programs here with the same problem...
– BenNevis
Nov 30 at 10:58
Can you provide what the value is now in that registry? and what is the type of that registry like
REG_SZ
or REG_EXPAND_SZ
?– Biswapriyo
Nov 30 at 7:24
Can you provide what the value is now in that registry? and what is the type of that registry like
REG_SZ
or REG_EXPAND_SZ
?– Biswapriyo
Nov 30 at 7:24
Why can’t you just branch the code, if the key exists, the do whatever you need to do for that version of Office. There is at most 5 conditions you would be using. Just use static values, keep it simple, don’t make it harder then it needs to be. The alternative is to determine which versions of Office are deployed.
– Ramhound
Nov 30 at 7:25
Why can’t you just branch the code, if the key exists, the do whatever you need to do for that version of Office. There is at most 5 conditions you would be using. Just use static values, keep it simple, don’t make it harder then it needs to be. The alternative is to determine which versions of Office are deployed.
– Ramhound
Nov 30 at 7:25
this is not only about word, there are some other special programs here with the same problem...
– BenNevis
Nov 30 at 10:58
this is not only about word, there are some other special programs here with the same problem...
– BenNevis
Nov 30 at 10:58
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1379667%2fhow-to-change-a-registry-value-with-a-variable-in-path%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Can you provide what the value is now in that registry? and what is the type of that registry like
REG_SZ
orREG_EXPAND_SZ
?– Biswapriyo
Nov 30 at 7:24
Why can’t you just branch the code, if the key exists, the do whatever you need to do for that version of Office. There is at most 5 conditions you would be using. Just use static values, keep it simple, don’t make it harder then it needs to be. The alternative is to determine which versions of Office are deployed.
– Ramhound
Nov 30 at 7:25
this is not only about word, there are some other special programs here with the same problem...
– BenNevis
Nov 30 at 10:58