troubleshooting Question

parsing values from string in a windows batch file

Avatar of pianomanJoe
pianomanJoeFlag for United States of America asked on
Microsoft DOSWindows OS
15 Comments1 Solution373 ViewsLast Modified:
Hi.  I am trying to write a windows batch script that parses a string of data to capture key elements.  The string contains both a token and the associated value.  The double carat (^^) separates the value and the double @@ separates the token/value pair.  For example with ACCESSKEY^^$P_ACCESSKEY, ACCESSKEY is the token, 123456 is the value.  @@ indicates a new token/value pair is beginning.  

I need a script that will parse the values from the scripts, i.e. the data between ^^ and @@.  Also, the tokens that begin with APP_PARM_ are optional, so I need to check if they exist, and if they do, parse the full APP_PARM_ token and value.  

Here is the data string that will be evaluated:
ACCESSKEY^^123456@@SECRETKEY^^98654321@@CONFIG_METHOD^^EBS_CONFIG@@APP_PARM_DBENDPOINT^^testdb@@APP_PARM_DBPASSWD^^access@@APP_PARM_DBUSER^^portalMaster@@APP_PARM_DBNAME^^DBTest

I'm not having any success with generating anything close.  So any help would be greatly appreciated!  Thanks,  Joe
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 15 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 15 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros