This is my first attempt at a serious batch file. I am making this for my work and without going into too much detail, as I know there are better ways to do the process I want, I want this batch file to ask the user for permission to check for online updates, install them, then restart automatically. If the user does not approve, I want the file to ask close and ask again after 2 hours.
The Code:
@echo off
title Weekly Windows Updater
echo ###################################################################################
echo # #
echo # In order to prevent common problems such as connection or display errors, #
echo # REDACTED is asking that updates be performed weekly! #
echo # #
echo # Don't worry! This process is mostly hands off for our teachers and staff! #
echo # Just give this bot approval by typing y for yes, or n for no. #
echo # #
echo # NOTE: THIS PROCESS MAY TAKE 5-20 MINUTES TO COMPLETE! #
echo # ANY DOCUMENTS OPEN WILL NEED TO BE SAVED PRIOR #
echo # TO APPROVING THIS BOT TO RUN UPDATES! #
echo ###################################################################################
REM Will ask the user if updates can run.
:choice
set /P c=May we run Windows Updates on your laptop?[Y/N]?
if /I "%c%" EQU "Y" goto :Approved
if /I "%c%" EQU "N" goto :Not_Approved
goto :choice
:Approved
call wuaclt.exe
:Not_Approved
REM close program and run again after x hours
pause
I have run through several online sources on ways to open the command prompt or powershell, as well as ways to have Windows Update run by going into System32 and launching the .exe file. I have tried functions like EXECUTE, call, and START. My most common error with this project has been "'NEEDS' is not recognized as an internal or external command, operable program or batch file." Yet all examples of ways to fix it have not worked for me.
As I said, I am quite new to building a file like this and am not sure what I am missing.