Solved [Batch] Get the second line of a txt file

May 19, 2012 at 05:48:57
Specs: Windows Vista home premium sp 2
how do I get the second line of a txt file (harder than it seems)
I'm using reg review to get a programs folder.
this is what it outputs

    InstallDir    REG_SZ    C:\Program Files\AutoHotkey

how do I make it so that it extracts just the location (3rd line)
if you know of another way that gets just the location (i still want to use the registry because
because i want it to be dynamic


See More: [Batch] Get the second line of a txt file

Report •

May 19, 2012 at 09:13:41
Call me crazy; I see TWO lines.

Life is too important to be taken seriously.


Report •

May 19, 2012 at 19:43:41
There is actually 5 lines, 3 of which are blank, of the 2 lines left i want the folder location (C:\Program Files\AutoHotkey) without any of the other things
this is what im using to output that info (unaltered) to a txt file
REG QUERY "HKLM\SOFTWARE\AutoHotkey" /v "InstallDir">test.txt

can you tell me how to get rid of everything except the dir (of the program not the reg key)

Report •

May 19, 2012 at 21:14:40
✔ Best Answer
dosnt matter i got it, its simple (I found how someone else did it(my base) but they had "Program" insteadof "Program Files" so I just did it like this
@ECHO off
set found=
FOR /F "tokens=1-2* delims= " %%a IN ('REG QUERY "HKLM\SOFTWARE\AutoHotkey" /v "InstallDir"') DO (
 set found=%%c

echo %found%

it gives me
C:\Program Files\AutoHotkey

now all I have to do is add quotes and it is done.
Thanks anyway


Report •
Related Solutions

Ask Question