user198989
user198989

Reputation: 4665

Bat file - Hide all messages

I have @echo off at the beginning, and exit at the end.. The bat adds entry to registry. However, if the registry exists, it gives this message. How to avoid that ? Thanks.

enter image description here

Upvotes: 0

Views: 181

Answers (1)

SomethingDark
SomethingDark

Reputation: 14305

echo y|reg add HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v "appdataid" /d %appdata%\data.vbs if you want to overwrite the existing entry

echo n|reg add HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v "appdataid" /d %appdata%\data.vbs if you don't

Also, if for some reason you don't want to (or can't) pipe the echo output, you can force reg add to overwrite the value with the /f flag, like reg add HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v "appdataid" /d %appdata%\data.vbs /f

Upvotes: 2

Related Questions