Thanks Pratik: You inspired me to bang away at this issue again. I have now, on my windows 11 box, successfully created a folder over 400 bytes deep!
Here's the steps:
make a .BAT file with the following contents:
md o123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789o1234_ThisIs100bytes
cd o123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789o1234_ThisIs100bytes
md o123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789o1234_ThisIs200bytes
cd o123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789o1234_ThisIs200bytes
md o123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789o1234_ThisIs300bytes
cd o123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789o1234_ThisIs300bytes
md o123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789o1234_ThisIs400bytes
cd o123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789o1234_ThisIs400bytes
run that and it works fine on my windows 11 boxes. That .BAT works great from either cmd console and powershell console.
However, my original powershell script still fails. I suspect that the issue is relative pathnames and UNC. i.e. for long path support the OS really likes "\?" at the beginning of the filename. My original script was using "./" or "." at the beginning, and that prefix might mess up windows 11 - whereas windows 10 handles it fine.
Now that I managed to create some long paths, I went ahead and tested my long path aware application and it works great with these deep paths!
So, my takeaway from all this:
a) To enable long paths: use the group policy technique: Local Computer Policy, Computer Configuration, Administrative Templates, System, Filesystem, Enable Win32 long paths, set this to Yes, and then reboot.
b) avoid relative pathnames in scripts.
Thanks again Pratik for proving us all wrong here, and that we can have deep folders in windows 11.