tags:

views:

22

answers:

1

I am a windows batch dunce.

I have a variable storing some text surrounded by hard brackets like:

[glcikLhvxq1BwPBZN0EGMQ==]

But I need to pass it as an argument like:

glcikLhvxq1BwPBZN0EGMQ==

How can I strip these hard brackets from the beginning and end in my windows batch file?

+2  A: 

You can use the sub-string syntax:

set foo=[glcikLhvxq1BwPBZN0EGMQ==]
set foo2=%foo:~1,-1%

which will remove the first and last characters. The sub-string starts here at the second character (so 1, zero-based) and extends until the second-to-last character (-1).

This is detailed more thoroughly in help set.

Joey
Excellent! I'm going to give it a try going directly into the argument, but very helpful none the less!
Adam