Mega Best Bug: square brackets on folder and files generate error

Hello,

I just installed version 7.3.3

I did my test number1 and then uninstalled powershell again because the very serious problem persists.

Problem: when a folder or file contains square brackets several cmdlets generate error.

ex: CD “C:\MusicCollection\Yes [Drama]”

“CD” is an alias for “Set-Location” - in this case it mistakenly forces the use of the “-LiteralPath” option.

I remind you that in the Win-NT operating system the only characters that are not allowed to be included are “/:*?”<>|" , square brackets are allowed so the need to use the “-LiteralPath” option is a (serious) error of logical beginning.

Question: when are you going to definitely solve this basic but very serious error that exists in several cmdlets?

Thanks

Hello,

I am not a powershell developper - simply a user - but I think your logic here is wrong. Powershell has never been designed to follow any MS-DOS/WinNt standards. And I really don’t think this is an issue.
If you want to include path with square brackets, you can ! You simply have to use escape characters.

CD 'C:\MusicCollection\Yes `[Drama`]'

Now the strange thing I am not able to say is why (below) the first command runs correctly, and why the md command has to use escape characters.

md "Yes [data]" # no issues
cd "Yes [data]" # this does not work
 cd ".\Yes ``[data``]\" # This works
 cd '.\Yes `[data`]\' # This also works

But anyway, you simply have to adapt your code to make it work.

Autocompletion using the TAB key always help

Sorry, I’m not into doing tricks and magics just because my folder or file has square brackets !!! my folder is within the rules so…

If i open a ms-dos window or a terminal in linux i don’t have this SERIOUS BUG

Wildcards are described here : about Wildcards - PowerShell | Microsoft Learn

I understand that you don’t agree with them, but a bug is a fault in a machine, especially in a computer system or program as per bug_1 noun - Definition, pictures, pronunciation and usage notes | Oxford Advanced Learner's Dictionary at OxfordLearnersDictionaries.com

What you are encountering is expected by the syntax definition of powershell. You may not agree with what has been chosen, but by no means, this can be described as a bug.
What you are experiencing is within the specs of the tools you are using.

2 Likes

Tarzanzito,
Welcome to the forum. :wave:t3:

This forum is a peer to peer forum where PowerShell coders voluntarily help other PowerShell coders with their challenges. It is not related to Microsoft and the PowerShell team.

If you find a bug you should look it up if it already has been filed and if not you may file a bug in the publicly available Github-Repo.

1 Like

This is incorrect. The -Path parameter is the default and it requires you to escape square brackets. -Literalpath has no issues with square brackets. You should do more testing before jumping to conclusions. As you can see in the example below, if I don’t specify, it defaults to Path. If i specify literalPath, it works fine.

image

1 Like

I didn’t know the scope of this forum…

Thanks for infomation !!!

did you read my post?

Don’t tell me what is or is not a bug!!! DAH

For me it’s BIG BUG !!!
The expected behavior in the cmdlet must respect what was always expected !!!

So there is an airplane with defined and known behaviors and it always flies. Then comes an expert and creates Wildcards.
And the plane no longer behaves as expected and in certain cases stopped flying!!!
Beautiful logic !!!

I did. It appears you did not read my reply.

Please, if you think it is a bug you should file it at the proper place. This is not the proper place for it. It does not make any sense to argue about opinions or expectations. :wink: