script (.bat) to add REG_SZ with a data value in this path

1

I am looking for a script (.bat) to add REG_SZ with a data value in this path:

HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Default

please advise

Ahmed Ali Elkosairy

Posted 2017-02-19T11:27:36.870

Reputation: 11

Answers

1

Use REG command

@echo off

REG ADD "HKCU\Software\Microsoft\Terminal Server Client" /ve /f /d "string data"

To activate registry changes in HKEY_CURRENT_USER without logging off, you may want to add following command:

RUNDLL32.EXE USER32.DLL,UpdatePerUserSystemParameters,1,True

You can read more about using reg here

Alex

Posted 2017-02-19T11:27:36.870

Reputation: 5 606

REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client" /t REG_SZ /d "test" /f

If you want to update the actual "(Default)". – HelpingHand – 2017-02-19T11:45:39.427

@EMK "default" value should be set with /ve and /t REG_SZ is set by default in reg. – Alex – 2017-02-19T11:53:05.353

Are you sure those spaces are in the right place in the rundll32.exe command line? They look wrong to me... – a CVn – 2017-02-19T11:53:56.267

@MichaelKjörling You absolutely right, result of copy/pasting :( Fixed, thanks for the help to improve it – Alex – 2017-02-19T11:56:01.697