batch file - Get Errorcode of Reg Query in one Line -


i want either 0 or 1 following reg query: reg query "hklm\software\microsoft\windows\currentversion\windowsupdate\auto update\rebootrequired"

instead of getting updates or error message, want output errorcode.

the problem is, whole command must put in 1 line!

something "reg query.... 2>&1 | echo %errorlevel%

thanks!

sorry bad english!

if need on 1 line need force delayed expansion enabled can echo errorlevel correctly.

cmd /v:on /c "reg query "hklm\software\microsoft\windows\currentversion\windowsupdate\auto update\rebootrequired" >nul 2>&1 &echo !errorlevel!" 

you can use this.

reg query "hklm\software\microsoft\windows\currentversion\windowsupdate\auto update\rebootrequired" >nul 2>&1 &call echo %^errorlevel% 

Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -