Page 1 of 1
Funny Windows 11 Non-Glitch
Posted: 04 Oct 2021 17:39
by GeoffVass
Just found one of my scripts broke on Windows 11.
I had something like this:
Code: Select all
SetLocal EnableDelayedExpansion
<do some stuff>
if defined Result (echo Success) else (echo Failure!!)
EndLocal
This has always worked, but on Windows 11 it glitches. You can probably guess the
in the echo command is the culprit.
Re: Funny Windows 11 Non-Glitch
Posted: 04 Oct 2021 21:45
by Squashman
Not explicitly understanding what you think the glitch is? There has always been an issue with displaying exclamations when delayed expansion is enabled.
Re: Funny Windows 11 Non-Glitch
Posted: 04 Oct 2021 23:28
by GeoffVass
The glitch is that I should never have used exclamation marks cosmetically. But it used to work, and now doesn't. So either Microsoft has fixed a bug in Windows 11, or introduced one. Anyway I've just removed the exclamation marks. My point is that it's weird to find some changed behavior in CMD.EXE so quickly.
Re: Funny Windows 11 Non-Glitch
Posted: 05 Oct 2021 02:18
by aGerman
You are showing us a piece of code but not what you get on Win 11 in comparison to what you got on Win 10 ¯\_(ツ)_/¯
Code: Select all
@echo off
SetLocal EnableDelayedExpansion
set "Result="
if defined Result (echo Success) else (echo Failure!!)
set "Result=X"
if defined Result (echo Success) else (echo Failure!!)
EndLocal
pause
Output on Win10:
Code: Select all
Failure
Success
Drücken Sie eine beliebige Taste . . .
Of course it's absolutely expected that the exclamation points are removed because they are treated as an empty/undefined variable if delayed expansion is enabled.
So if you take this example and run it on Win 11, what's the difference?
Steffen
Re: Funny Windows 11 Non-Glitch
Posted: 05 Oct 2021 12:45
by aGerman
Alright, let me answer this question myself. Installed Win 11, ran the script, and the output is
Code: Select all
Failure
Success
Drücken Sie eine beliebige Taste . . .
The difference is that it shows up in a console window with round corners
Steffen
Re: Funny Windows 11 Non-Glitch
Posted: 05 Oct 2021 12:52
by Squashman
aGerman wrote: ↑05 Oct 2021 12:45
The difference is that it shows up in a console window with round corners
I draw the line on round corners. Never upgrading to Windows 11!!
Re: Funny Windows 11 Non-Glitch
Posted: 05 Oct 2021 13:05
by atfon
Squashman wrote: ↑05 Oct 2021 12:52
aGerman wrote: ↑05 Oct 2021 12:45
The difference is that it shows up in a console window with round corners
I draw the line on round corners. Never upgrading to Windows 11!!
Maybe write a script that converts round corners to square?

Re: Funny Windows 11 Non-Glitch
Posted: 05 Oct 2021 13:28
by aGerman

I'm far too pragmatic to get upset about those details. As long as everything works I'm still ok if they make concave corners having flourish. After a few days I don't even notice it anymore
