Owl Surojit
Owl Surojit

Reputation: 183

Running a windows reg add command in non-interactive mode

I'm trying to write a small batch script that is supposed to change some registry entries.

Now to do that from the command line one would use the reg add command. And when the specified registry key already exists it asks to overwrite the value.

For example reg add "HKCU\Control Panel\Colors" /v Background /t REG_SZ /d "120 0 0" yields Value Background exists, overwrite(Yes/No)? and only if I press y the command completes.

It does the same when the command is issued from a batch script. Since I would like the process to be automated and no further user input to be required I would like to remove the confirmation request. So is it possible to run this command non-interactively?

Upvotes: 0

Views: 7870

Answers (1)

GChuf
GChuf

Reputation: 2260

You can either use the /F flag as mentioned by Compo in the comments, or you can use a .reg file and start it in silent mode:

start regedit /s "C:\path\to\regfile.reg"

Upvotes: 0

Related Questions