La séance de questions et réponses d’aujourd’hui nous est offerte par SuperUser, une sous-division de Stack Exchange, un groupe de sites Web de questions-réponses dirigé par la communauté.
La question
Luu Vinh Phuc, lecteur superutilisateur, veut savoir pourquoi dir *. * Répertorie tous les fichiers et dossiers:
When I run the dir *.* command, it produces unexpected results. Even files and folders without any dot in the name are listed. For example:
Pourquoi dir *. * Répertorie-t-il tous les fichiers et dossiers?
La réponse
Fleet Command, contributeur de SuperUser, a la solution pour nous:
The DIR command comes from a time when:
- A period (.) was not allowed as a character in file or folder names
- File and folder names were restricted to 8 characters for names and 3 characters for extensions
Therefore, by that standard, *.* meant whatever the name and whatever the extension. It did not mean a string containing a “.”, which may or may not have characters before or after the “.”.
Microsoft’s policy is preserving backward compatibility, so that interpretation of *.* is retained. But in Windows PowerShell, *.* means a string containing a “.”, which may or may not have characters before or after the “.”.
Avez-vous quelque chose à ajouter à l'explication? Sound off dans les commentaires. Voulez-vous lire plus de réponses d'autres utilisateurs de Stack Exchange doués en technologie? Découvrez le fil de discussion complet ici.