enthuguy
asked on
How to extract string value and construct contact string in Windows Batch
Hi
Could you help with below please.
Scenario:
- In Windows batch, would like to check a folder with specific file pattern e.g *.sif. We might find 1 or more files. Files are in sif extension but it just a text file in xml style. (not binary)
- Look for string "PROCESS_NAME" and get the value of of it. E.g PROCESS_NAME="TEST Workflow 1"
- Loop through all files in the directory and get all values. E.g. if we find "TEST Workflow 1" and "TEST Workflow 2" etc etc.
- Variable should be set like below.
e.g workflow_list='TEST Workflow 1','TEST Workflow 2','TEST Workflow 3'
If it is easy in powershell, we can do that, but is it easy to bring the value back to batch variable please
Have attached two sample files.
Thanks in advance :)
wf_nxg_application_error_handler_wor.txt
wf_nxg_publish_error_republish_batch.txt
Could you help with below please.
Scenario:
- In Windows batch, would like to check a folder with specific file pattern e.g *.sif. We might find 1 or more files. Files are in sif extension but it just a text file in xml style. (not binary)
- Look for string "PROCESS_NAME" and get the value of of it. E.g PROCESS_NAME="TEST Workflow 1"
- Loop through all files in the directory and get all values. E.g. if we find "TEST Workflow 1" and "TEST Workflow 2" etc etc.
- Variable should be set like below.
e.g workflow_list='TEST Workflow 1','TEST Workflow 2','TEST Workflow 3'
If it is easy in powershell, we can do that, but is it easy to bring the value back to batch variable please
Have attached two sample files.
Thanks in advance :)
wf_nxg_application_error_handler_wor.txt
wf_nxg_publish_error_republish_batch.txt
ASKER
Thanks a lot Bill :)
ASKER
Hi Bill
sorry, based on the new finding the way powershell accepts
can we surround with escape char ` please
workflow_list=`'TEST Workflow 1`'`,`'TEST Workflow 2`'`,`'TEST Workflow 3`'
sorry, based on the new finding the way powershell accepts
can we surround with escape char ` please
workflow_list=`'TEST Workflow 1`'`,`'TEST Workflow 2`'`,`'TEST Workflow 3`'
What do you want the actual DOS environment variable to contain? Do you really want all those varied quotes?
»bp
`'TEST Workflow 1`'`,`'TEST Workflow 2`'`,`'TEST Workflow 3`'
»bp
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks a lot bill, really appreciate ur help
ASKER
Thanks once again Bill, that was a timely help and it worked perfectly for me
»bp