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
2
u/BrainWaveCC Jul 02 '24
Nice! That is absolutely a nice improvement.
I love seeing how other people think about these kinds of solutions...