Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
foxidrive
- Expert
- Posts: 6031
- Joined: 10 Feb 2012 02:20
#1
Post
by foxidrive » 12 Jul 2013 13:40
Well, well well.
Hands up who knew that the delimiters in a for /F were case sensitive? I didn't.
Code: Select all
@echo off
for /f "delims=abc" %%a in ("ABCabc") do set "var=%%a"
echo "%var%"
pause
It returns:
"ABC"It has been 10 or more years that I've been using delims and never have I struck an instance where the case was an issue - luck I guess.
-
Squashman
- Expert
- Posts: 4471
- Joined: 23 Dec 2011 13:59
#3
Post
by Squashman » 12 Jul 2013 15:06
I kind of assumed it but never tested it because the token variables are case sensitive I would assume the delims are as well.
-
foxidrive
- Expert
- Posts: 6031
- Joined: 10 Feb 2012 02:20
#4
Post
by foxidrive » 12 Jul 2013 17:26
Yes indeed. I added my own bit too and didn't realise that Aacini's was spot on.
Squashman wrote:I kind of assumed it but never tested it because the token variables are case sensitive I would assume the delims are as well.
It's actually more useful being case sensitive. Can't get over it being something so obvious but I never struck it until today.
I was filtering out characters from a DATE command and tripped over it...