I've got similar information stored in two variables, both containing Windows share names.
set _N= net use N: \\WS1\DISK2; net use O: \\WS1\DISK3; net use P: \\WS2\DISK3; net use Q: \\WS3\DISK2; net use U: \\WS-NAS1\NAS1; net use V: \\WS5\DISK4;
set _DRV2map= \\WS1\DISK3 \\WS2\DISK3 \\WS-NAS1\NAS1
_N
always contains all the values stored in _DRV2map
.
How can I compare the two variables and retrieve information by getting a handle onto the corresponding expressions in _N
.
With this example data the desired result should be as follows:
Starting with _DRV2map
the result for the term \\WS1\DISK3
should be net use O: \\WS1\DISK3
retrieved from _N
.
Likewise for \\WS2\DISK3
the return is net use P: \\WS2\DISK3
and for \\WS-NAS1\NAS1
the return is net use U: \\WS-NAS1\NAS1
The important information seeked is the drive letter (in _N
) for a given share name in both variables.
I am able to compare two variables and find the differences between them as long as both variables got their content structured equally. But in this case the content structure differs and I have no clue how to get started eventually leading to a meaningful result. That is the reason I did not provide any code. I don't even know whether this is possible using batch processing (I would not be surprised if it weren't).
Advice, help and suggestions are much appreciated. Greetings