Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
carlos
- Expert
- Posts: 503
- Joined: 20 Aug 2010 13:57
- Location: Chile
-
Contact:
#1
Post
by carlos » 26 Apr 2018 18:00
Hello. This is new for me.
On cmd.exe of windows 10 the variable names allow spaces:
Code: Select all
set var=a
set var =b
set var =c
echo %var%
echo %var %
echo %var %
it output:
-
Squashman
- Expert
- Posts: 4486
- Joined: 23 Dec 2011 13:59
#2
Post
by Squashman » 26 Apr 2018 18:30
It's not new. It has been this way for a while. I can't test on XP anymore but I am pretty sure it did it like that on XP as well. It certainly does it on Windows 7. I see people do that on StackOverFlow all the time. It is probably the 2nd biggest problem that newbies have with batch files next to delayed expansion.
-
carlos
- Expert
- Posts: 503
- Joined: 20 Aug 2010 13:57
- Location: Chile
-
Contact:
#3
Post
by carlos » 26 Apr 2018 18:41
Yes, I confirm it, is the same on windows xp. But today I write some code like that. I forget that feature.
-
Squashman
- Expert
- Posts: 4486
- Joined: 23 Dec 2011 13:59
#4
Post
by Squashman » 26 Apr 2018 19:10
carlos wrote: ↑26 Apr 2018 18:41
Yes, I confirm it, is the same on windows xp. But today I write some code like that. I forget that feature.
But the even confusing part is you can do this: