I think there is no inbuilt functions to do string related operations in agent procedures. For example, I am reading registry to get the application installation path which gives me like,
From the above registry value, I want to retrieve the directory path upto src like C:\Program File\application\name. Is that possible to do this within agent procedures or should I run any batch script? If there is a solution with single command line execute without any .bat file then it would be much appreciated.
Thanks in advance for any solution.
Nothing native to Agent Procedures that I'm aware of. You could play with the for & delims options in the command shell for one-offs; however, I actually use a set of Win32 ports of Unix string manipulation utilities (like head, tail & split) from here: http://unxutils.sourceforge.net/ They come in handy... so much so that I use Distribute Files to throw these on all managed machines.
Brian is correct -- string manipulation currently isn't something provided in the agent procedure engine, though you can use any number of solutions at the endpoint, whether that is a DOS FOR loop on a Windows machine or some other native OS capability like sed in Linux or OS X.
This is actually something I can look into getting in the agent procedure engine -- I don't think it would be too tasking. The result would be pretty simple. You would just have a new step titled 'String Manipulation' with two text boxes for input that will contain your sed-based string manipulation command and the new variable you wish to create from that command.
I have to explore the licensing restrictions of the Windows sed ports to see if we can do it. Since sed is present on Linux and OS X, this procedure step would support all operating systems.
Thanks Ben and Brain. As of today, I will play with batch program in case of windows.
Thanks once again.