Miksi dir *. * Luettele kaikki tiedostot ja kansiot?

Sisällysluettelo:

Miksi dir *. * Luettele kaikki tiedostot ja kansiot?
Miksi dir *. * Luettele kaikki tiedostot ja kansiot?

Video: Miksi dir *. * Luettele kaikki tiedostot ja kansiot?

Video: Miksi dir *. * Luettele kaikki tiedostot ja kansiot?
Video: Vernerin kuusi varttia | Traders' Club 169 - YouTube 2024, Huhtikuu
Anonim
Joskus saatat päätyä odottamattomiin tuloksiin käskyjen suorittamisen aikana, joten oppimisen "miksi" tulosten takana voi olla hyvin mielenkiintoista. Tämän vuoksi tämän päivän SuperUser Q & A -postilla on vastaus utelias lukijan kysymykseen.
Joskus saatat päätyä odottamattomiin tuloksiin käskyjen suorittamisen aikana, joten oppimisen "miksi" tulosten takana voi olla hyvin mielenkiintoista. Tämän vuoksi tämän päivän SuperUser Q & A -postilla on vastaus utelias lukijan kysymykseen.

Tämän päivän kysymys- ja vastausistunto tulee meihin SuperUserin hyväksi - Stack Exchangein alaosasto, joka on yhteisöllinen Q & A-sivustojen ryhmittely.

Kysymys

SuperUser-lukija Luu Vinh Phuc haluaa tietää, miksi dir *. * Luetellaan kaikki tiedostot ja kansiot:

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?

Miksi dir *. * Luetellaan kaikki tiedostot ja kansiot?

Vastaus

SuperUser-avustaja Fleet Commandilla on vastaus meille:

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

Onko jokin asia lisättävä selitykseen? Kuulkaa kommentit. Haluatko lukea lisää vastauksia muilta tech-tajuilta Stack Exchange-käyttäjiltä? Katso koko keskusteluketju täältä.

Suositeltava: