Removing meaning of & in string manipulation
Posted: 29 Mar 2007 07:05
Hi,
I am attempting to remove the meaning of & within a string manipulation. Is there a special character to do this (if you're familar with 'sed' for Linux then a \ normally suffices).
My code is:
set RPW_CLIP=%1
set RPW_CLIP=%RPW_CLIP:~3,-1%
Where %1 is from the command line and is:
"F:Bills Music\Blur\13\03. Coffee & TV.mp3"
I run the code and end up with
Bills Music\Blur\13\03. Coffee
I assume this is because the & is interpreted by the set command.
Placing quotes around the eval statement does resolve this.
set RPW_CLIP="%RPW_CLIP:~3,-1%"
However, by doing this causes me other issues, as I know have quotes around the variable which require removal (which is original objective of running the trimming to get rid of them).
If I am able to remove the meaning of the & (and any other special operator characters - if you know them let me know) this would enable the set to be evaluated and leave the formatting in place.
Any resolutions greatly appreciated!
Many thanks,
DJ
I am attempting to remove the meaning of & within a string manipulation. Is there a special character to do this (if you're familar with 'sed' for Linux then a \ normally suffices).
My code is:
set RPW_CLIP=%1
set RPW_CLIP=%RPW_CLIP:~3,-1%
Where %1 is from the command line and is:
"F:Bills Music\Blur\13\03. Coffee & TV.mp3"
I run the code and end up with
Bills Music\Blur\13\03. Coffee
I assume this is because the & is interpreted by the set command.
Placing quotes around the eval statement does resolve this.
set RPW_CLIP="%RPW_CLIP:~3,-1%"
However, by doing this causes me other issues, as I know have quotes around the variable which require removal (which is original objective of running the trimming to get rid of them).
If I am able to remove the meaning of the & (and any other special operator characters - if you know them let me know) this would enable the set to be evaluated and leave the formatting in place.
Any resolutions greatly appreciated!
Many thanks,
DJ