Kodėl dir *. * Sąrašas visų failų ir aplankų?

Turinys:

Kodėl dir *. * Sąrašas visų failų ir aplankų?
Kodėl dir *. * Sąrašas visų failų ir aplankų?

Video: Kodėl dir *. * Sąrašas visų failų ir aplankų?

Video: Kodėl dir *. * Sąrašas visų failų ir aplankų?
Video: High Density 2022 - YouTube 2024, Balandis
Anonim
Kartais vykdant komandas gali atsirasti netikėtų rezultatų, todėl mokymasis "kodėl" už rezultatų gali būti labai įdomus. Atsižvelgdami į tai, šiandieninis SuperUser Q & A pranešimas turi atsakymą į įdomų skaitytojo klausimą.
Kartais vykdant komandas gali atsirasti netikėtų rezultatų, todėl mokymasis "kodėl" už rezultatų gali būti labai įdomus. Atsižvelgdami į tai, šiandieninis SuperUser Q & A pranešimas turi atsakymą į įdomų skaitytojo klausimą.

Šiandieninė klausimų ir atsakymų sesija pateikiama su "SuperUser" - "Stack Exchange", bendruomenės valdoma Q & A grupių asociacija.

Klausimas

SuperUser skaitytojas Luu Vinh Phuc nori žinoti, kodėl dir *. * Nurodo visus failus ir aplankus:

When I run the dir *.* command, it produces unexpected results. Even files and folders without any dot in the name are listed. For example:

Why is that? Is there any way to only list files with a dot?
Why is that? Is there any way to only list files with a dot?

Kodėl dir *. * Sąrašas visų failų ir aplankų?

Atsakymas

"SuperUser" autorius "Fleet Command" mums atsakė:

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 “.”.

Ar turite ką nors įtraukti į paaiškinimą? Garsas išjungtas komentaruose. Norite skaityti daugiau atsakymų iš kitų "Tech-savvy Stack Exchange" vartotojų? Patikrinkite visą diskusijų temą čia.

Rekomenduojamas: