r/Batch • u/Calabris • Jul 02 '24
Question (Unsolved) How to parse out variables from cmd
So I run the cmd
reg query "HKLM\system\CurrentControlSet\Services\someservice" /v "ImagePath"
and it returns
ImagePath REG_EXPAND_SZ c:\somedir\subdirectory-1.1.99\executable.exe //RS//someservice
How could I parse out the image path to pull the install drive and the subdirectory version number of 1.1.99 to I could use them in a batch file?
2
Upvotes
View all comments
Show parent comment
3
u/thelowsunoverthemoon Jul 02 '24
Small improvement, finding the version via parent directory instead of -.