Kaseya Community

how to extract a line from a txt file for a variable

  • HI folks,

    I have a txt file that has 3 lines of text

    the file is an output from a dos command

    I want the middle line and I know it begins with HKEY_LOCAL_MACHINE\

    Is there any simple dos commands (find for example) that I can run on this file to get the line.

    I want it for a variable for kaseya so I can run a reg key against it.



    P.s The file is created by a REG Query command initially.



  • Hi Michael,

    I assume you have run a shell command that is something like

    reg query blahblahblah >> #tempdir#\output.txt

    If you just modify the shell command to be

    reg query blahblahblah | find "HKEY_LOCAL_MACHINE" >> #tempdir#\output.txt

    then the output file will contain only the line you are interested in.

    Also please select question when asking questions on the forum.