windows - Batch FOR loop over REG QUERY directory -


i trying echo list of each registry key in hkcu directory. in cmd can run following command

reg query hkcu\environment\ 

which correctly returns

temp    reg_expand_sz    %userprofile%\appdata\local\temp tmp    reg_expand_sz    %userprofile%\appdata\local\temp 

however, trying modify below for loop created loop on files , folders in normal windows directory structure, not work when working registry keys

for /d %%k in ("%appdata%\mozilla\firefox\profiles\*") (     @echo %%~nxk ) 

the above loop works fine , outputs directory names

i tried changing to

for /d %%k in ("reg query hkcu\environment\") (     @echo %%~nxk ) 

the above not seem work.

also, /d parameter provided in for loop apparently syntax-for-folders, not sure registry key recognised as.

did mean extract path :

@echo off /f "tokens=2*" %%a in ('reg query hkcu\environment\') @echo "%%b" pause 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -