0

I am making a batch script and I am having trouble with this line

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v AUOptions /t REG_DWORD /d 3 /f

When that line runs, the command prompt window closes suddenly. This line is supposed to turn on automatic updates. Thanks for your help.

jeb
  • 78,592
  • 17
  • 171
  • 225

1 Answers1

1

The command you've shown should work okay, at least in the meaning of any syntas error.

The problem, as per you described in the comments, maybe is that you are not taking into account that when a script has finished, the window has any reason to still open. Or in other words, when all the sentences of you're script are done, the window closes "suddenlly" (the program ends execution).

To pause the batch execution, just use the PAUSE command as follows:

@Echo Off
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v AUOptions /t REG_DWORD /d 3 /f
PAUSE
Exit /B 0
ElektroStudios
  • 19,105
  • 33
  • 200
  • 417