Hi all
I have a task like below:
input:
\T501-08680-0101-T3_Mockup_Generic_Scheme_Pack\T501-08680-0101\Application_Signing\Signed_Schemes\MockupSigned_T3\500007011000.S3S”
output:
\T501-08680-0101\Application_Signing\Signed_Schemes\MockupSigned_T3\500007011000.S3S”
Basically I would like to trim off the string from beginning \ and before next \ , like this case:
trim off:
\T501-08680-0101-T3_Mockup_Generic_Scheme_Pack
and this string is sometime longer or shorter...so we can not used fixed characters to do the job...
Any clue we can use \ and \ to trim off the string in between...
Thanks
remove string between \****\abcdefghijklm
Moderator: DosItHelp
-
- Expert
- Posts: 1166
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: remove string between \****\abcdefghijklm
When you use a wildcard with for loop tokens, the delimiter remains in the token handled by the wildcard. All you have to do is split the string on \ and just return the second token.
Code: Select all
for /f "tokens=1,* delims=\" %%A in ("\T501-08680-0101-T3_Mockup_Generic_Scheme_Pack\T501-08680-0101\Application_Signing\Signed_Schemes\MockupSigned_T3\500007011000.S3S”) do echo %%B
Re: remove string between \****\abcdefghijklm
Thanks ShadowThief!!