:: Offer to reboot/logoff if "%PENDING%"=="REBOOT" ( echo. choice /c YN /m "Reboot now? " if errorlevel 1 shutdown /r /t 30 /c "GPUpdate requires reboot" exit /b 0 ) if "%PENDING%"=="LOGOFF" ( echo. choice /c YN /m "Logoff now? " if errorlevel 1 shutdown /l exit /b 0 )
:: Log file set LOGFILE=%USERPROFILE%\Desktop\GPUpdate_Log_%DATE:~10,4%%DATE:~4,2%%DATE:~7,2%_%TIME:~0,2%%TIME:~3,2%.txt set LOGFILE=%LOGFILE: =0% windows gpupdate
$timestamp = Get-Date -Format "yyyyMMdd_HHmmss" $logFile = "$env:TEMP\GPUpdate_$ComputerName`_$timestamp.log" :: Offer to reboot/logoff if "%PENDING%"=="REBOOT" ( echo