1

picture_1

I created the file its name is 'asdf:qwer'.

'asdf' file was created, and I input some words.

'asdf' capacity is 0, Hex has no contents.

pitcture_2

But I can get words.

  1. Where they come from?

  2. What is colon(:)'s functions in Windows shell?

Sungwoo
  • 28
  • 1
  • 6
  • 1
    Under Windows and the NTFS file system the colon is an illegal character, **because it is used to open alternate file streams**. However all other characters **can be moved on and off the NTFS file system if a program with Unicode support is used**. [Source](https://kb.acronis.com/content/39790) – lifus Feb 05 '15 at 18:12

1 Answers1

5

Colon is not an allowed character in a filename in Windows. Or, more precisely, it is used to address an Alternate Data Stream of a file. So, asdf:qwer addresses the stream named qwer of the file named asdf.

This is very similar to the backslash. asdf\qwer is also not a valid filename, instead it addresses the file qwer of the folder asdf.

Jörg W Mittag
  • 363,080
  • 75
  • 446
  • 653
  • actually some windows APIs allows you to use : in filenames, and some do not. For example, the [CreateFile api](https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea) disallows : in filenames, while the [NtCreateFile api](https://learn.microsoft.com/en-us/windows/win32/api/winternl/nf-winternl-ntcreatefile) allows you to use : in filenames. (why? dunno, I guess [Microsoft developers were drunk](https://xkcd.com/323/) or something) – hanshenrik Jun 23 '22 at 14:28