Jump to content

Count subkeys in registry.


Recommended Posts


The following batch should do the trick ( couldn't really test it, cause there's only one subkey on my machine:

@echo off
setlocal enableextensions
set count=-3
For /F %%i in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains"') Do call :increase
echo Blocked Domains: %count%

:increase
set /A count=%count%+1
goto :EOF

endlocal

Link to comment
Share on other sites

works well enough for me like this

@echo off
setlocal enableextensions
set count=-3
For /F %%i in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains"') Do call :increase
echo Blocked Domains: %count%
endlocal
goto :eof

:increase
set /A count=%count%+1
goto :EOF

Here is my alternative version

@echo off&setlocal enableextensions&mode 30,2&color e5&title Script By Yz”wl
set "key=\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains"&set "count=0"
for /f "tokens=*" %%? in ('REG QUERY "HKLM%key%" /s^|find "%key%\"^2^>nul') do if errorlevel 0 echo/%%~nx?|findstr/v "[.]">nul 2>&1||set/a count+=1
echo/ You have %count% Blocked Domains&ping -n 6 127.0.0.1>nul&endlocal&goto :eof

should be four lines

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...