CCC
CCC

Reputation: 2242

How to set value in registry via batch file in Windows?

I am going to set a value to windows registry. I want to set variable shit for StupidMS in registry, but the result is wrong. Following is my code.

set stupidMS=shit
echo %stupidMS% 

reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run" /v "StupidMS" /t REG_SZ /d ^%stupidMS^%

I think the problem is ^%stupidMS^%, but I quite have no idea how to correct it.

Upvotes: 6

Views: 25038

Answers (1)

CCC
CCC

Reputation: 2242

reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run" /v "StupidMS" /t REG_SZ /d "%stupidMS%"

Upvotes: 6

Related Questions