Reg query problem

Hi guys,

reg query "hklm\software\microsoft\windows nt\currentversion\profilelist" /s | find /i "S-1-5-21">> parent.txt

This gives me:

=========================== parent.txt
HKEY_LOCAL_MACHINE\software\microsoft\windows nt\currentversion\profilelist\S-1-5-21-1187487854-1727753276-2704374040-103101.bak
HKEY_LOCAL_MACHINE\software\microsoft\windows nt\currentversion\profilelist\S-1-5-21-1187487854-1727753276-2704374040-4229

But, when I then do:

for /f %%c in (parent.txt) do @echo %%c

I get:

HKEY_LOCAL_MACHINE\software\microsoft\windows
HKEY_LOCAL_MACHINE\software\microsoft\windows

instead of:

HKEY_LOCAL_MACHINE\software\microsoft\windows nt\currentversion\profilelist\S-1-5-21-1187487854-1727753276-2704374040-103101.bak
HKEY_LOCAL_MACHINE\software\microsoft\windows nt\currentversion\profilelist\S-1-5-21-1187487854-1727753276-2704374040-4229

Any help greatly appreciated.
LVL 1
Simon336697Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Farhan KaziSystems EngineerCommented:
Try this:

for /f "delims=" %%c in (parent.txt) do @echo %%c

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Simon336697Author Commented:
Hi farhankazii,

That works thanks so much, but im not sure why it works.
0
Farhan KaziSystems EngineerCommented:
If you specify delims=xxx in FOR statement, it will replace the default delimiter which is set to space and tab. This is the reason you were getting everything before the first space (in Windows NT)

HKEY_LOCAL_MACHINE\software\microsoft\windows nt\currentversion\profilelist\.....
                                                                                        ^
0
AmazingTechCommented:
You can also put in "tokens=*"
0
Bill PrewCommented:
Here are a couple of references that may help you master the FOR /F command a bit.

http://ss64.com/nt/for_cmd.html
http://www.robvanderwoude.com/ntfor.php

~bp
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.