computing
  • 30

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

  • 30

Hello,
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


HKEY_LOCAL_MACHINESOFTWAREAutoHotkey
    InstallDir    REG_SZ    C:Program FilesAutoHotkey


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
Thanks

Mattzz

Share

0 Answers

  1. 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 "HKLMSOFTWAREAutoHotkey" /v "InstallDir"') DO (
     set found=%%c
    )
    
    echo %found%

    it gives me

    C:Program FilesAutoHotkey

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

    Matt

    • 0