first of all sorry for my bad english. i have to check, if uac is running or not.
REG QUERY HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\ /v EnableLUA
This command returns 0x0 when UAC isn't running, otherwise 0x1. But it returns with other useless stuff that i'm still not needing.
is there any possibilitie to only filter the 0x0/0x1 into a variable an save it to a txt file?
for /f "tokens=3" %%a in (
'REG QUERY HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\ /v EnableLUA'
) do set "UAC=%%a"
> "someFile.txt" echo %UAC%
The for /f
will execute the command, read its output and split the lines using the spaces and tabs as delimiters. We are asking for the third token. As the usual output of reg
command is
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System
EnableLUA REG_DWORD 0x1
there is only one line with at least three tokens, so only this line will be processed. As we are requesting the third token, the 0x1
is stored in the for
replaceable parameter, that is assigned to the %UAC%
variable.
Then, the value of the variable is echoed to the indicated file