How to change a registry value with a variable in path?












-4














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 :)










share|improve this question
























  • 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












  • this is not only about word, there are some other special programs here with the same problem...
    – BenNevis
    Nov 30 at 10:58
















-4














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 :)










share|improve this question
























  • 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












  • this is not only about word, there are some other special programs here with the same problem...
    – BenNevis
    Nov 30 at 10:58














-4












-4








-4


0





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 :)










share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 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












  • 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










  • 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















active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















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






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Сан-Квентин

Алькесар

Josef Freinademetz