10

My problem is that, I can not give name of my folder or file with special characters like \ / : * ? " < > | in windows based O.S. This is very important for me, that giving name of file/folder which contain this type of characters.

I already search and refer so many site,for this problems but all are hopeless. I also read Microsoft support page, they suggest use other characters. This is its link, https://support.microsoft.com/en-us/kb/177506

I already try Alt button + ASCII code number of this type of special characters, from numpad key, just example rename file/folder and press Alt+60 (for < characters) Still it giving message that, A filename cannot contain any of the following characters: \ / : * ? " < > |

Suggest me suitable solution so that I can give name of my file/folder with this type of special characters.

Kirit_Vanani
  • 151
  • 1
  • 2
  • 9

3 Answers3

19

This is very important for me, naming of file/folder which contain these characters.

It may be important to you, but you will have to let this go and find a different way to solve your problem.

These characters are not allowed by the Windows OS function calls that handle filenames.

They are specifically not allowed because they have another use:

  • \ - Reserved for use as a path separator and escape character
  • / - Reserved for use as a path separator
  • : - Reserved for use as a drive name delimiter
  • * and ? - Reserved for use as wildcard characters
  • " - Reserved for use to quote names containing spaces
  • <, > and | - Reserved for use as command redirection operators

You can, of course, create files with names containing these characters using a different operating system (as long as that operating system can read/write a Windows file system).

However, you will be unable do do anything with those files using any Windows programs and they will not understand the file names and will generate errors.


Naming Files, Paths, and Namespaces

Naming Conventions

The following fundamental rules enable applications to create and process valid names for files and directories, regardless of the file system:

...

Use any character in the current code page for a name, including Unicode characters and characters in the extended character set (128–255), except for the following:

  • The following reserved characters:

    < (less than)
    > (greater than)
    : (colon)
    " (double quote)
    / (forward slash)
    \ (backslash)
    | (vertical bar or pipe)
    ? (question mark)
    * (asterisk)
    
  • Integer value zero, sometimes referred to as the ASCII NUL character.
  • Characters whose integer representations are in the range from 1 through 31, except for alternate data streams where these characters are allowed. For more information about file streams, see File Streams.
  • Any other character that the target file system does not allow.

Source Naming Files, Paths, and Namespaces


But I really want to do this anyway.

Install cygwin and use touch.

I haven't tested all the possibilities but the following work:

touch :
touch \|
touch \"
touch \>

Example output:

DavidPostill@Hal /f/test/impossible
$ ll
total 0
-rw-rw-rw-+ 1 DavidPostill None 0 Aug 10 21:03 '"'
-rw-rw-rw-+ 1 DavidPostill None 0 Aug 10 21:02 :
-rw-rw-rw-+ 1 DavidPostill None 0 Aug 10 21:02 '|'
-rw-rw-rw-+ 1 DavidPostill None 0 Aug 10 21:07 '>'

As you can see they are not usable in Windows:

F:\test\impossible>dir
 Volume in drive F is Expansion
 Volume Serial Number is 3656-BB63

 Directory of F:\test\impossible

10/08/2016  21:07    <DIR>          .
10/08/2016  21:07    <DIR>          ..
10/08/2016  21:03                 0 
10/08/2016  21:02                 0 
10/08/2016  21:07                 0 
10/08/2016  21:02                 0 
               4 File(s)              0 bytes
               2 Dir(s)  1,772,601,536,512 bytes free

enter image description here

DavidPostill
  • 153,128
  • 77
  • 353
  • 394
  • I appreciate your answer, it is little bit helpful, but my problem remain same.. I think any other super user way to rename with these special character. – Kirit_Vanani Aug 10 '16 at 19:41
  • 2
    @Kirit You can create files with those characters but Windows cannot do anything with them and you will get errors when you try and use those files from within Windows. – DavidPostill Aug 10 '16 at 19:51
  • @ DavidPostill Ohh, How to create file name with those characters. I don't mind if it give error, but now task is give these type of character name.. For access this file i will use other linux based os – Kirit_Vanani Aug 10 '16 at 19:59
  • 1
    @Kirit I already told you in the answer "You can, of course, create files with names containing these characters using a different operating system (as long as that operating system can read/write a Windows file system)." – DavidPostill Aug 10 '16 at 20:01
  • @Kirit You can also install cygwin and use `touch` (but I haven't tested all the possibilities) – DavidPostill Aug 10 '16 at 20:04
  • @Kirit See updated answer. You can create files with those characters but they are not usable. – DavidPostill Aug 10 '16 at 20:11
  • @Devid thanks, for your help, but I need (I plan) to give folder name with out any other Linux based os use. – Kirit_Vanani Aug 10 '16 at 20:28
  • 4
    @Kirit I already told you **it is not possible**. – DavidPostill Aug 10 '16 at 20:31
  • What's up with the DIR output? It looks like the characters have been mapped to high unicode. Is that true (or is it an artifact of the representation on SE), and if so, does it work in reverse, i.e. can I create a file using the unicode codepoint and read it in Cygwin as a reserved character? – Mario Carneiro Aug 10 '16 at 21:33
  • @MarioCarneiro I've no idea. That's what it showed when I tried it as an experiment. – DavidPostill Aug 10 '16 at 21:34
  • In what sense are those files "not usable in Windows"? Clearly windows can see them; can it read and write to them? Besides the funky printing, are there any errors you get with attempting to use the files? – Mario Carneiro Aug 10 '16 at 21:56
  • @MarioCarneiro It appears `cmd` can read and write them, although I had to use or wildcards to select the file. With explorer I can right click and do stuff. – DavidPostill Aug 10 '16 at 22:01
  • @MarioCarneiro It doesn't help the OP though as the names don't appear as he wishes from the Windows side of the fence. – DavidPostill Aug 10 '16 at 22:05
  • @DavidPostill Well, strictly speaking he never said that they needed to *appear* correct, only that he wanted to create files with the reserved characters. ;) – Mario Carneiro Aug 10 '16 at 22:17
  • @MarioCarneiro That's true. He can always accept my answer if that is the case :) – DavidPostill Aug 10 '16 at 22:19
  • @DavidPostil After referring some document and refer duplicate question answer i feel you are right.. – Kirit_Vanani Aug 11 '16 at 05:36
4

Build your own font set. Replace some of the characters you do not use with the images of the reserved characters.

Clayton
  • 497
  • 2
  • 8
3

In Windows, you cannot create files with those characters. There's no solution, these characters are prohibited by the Win32 API.

Win32 is a subset of the POSIX namespace and is case insensitive. It uses all the Unicode characters, except: '"' '*' '/' ':' '<' '>' '?' '\' '|' N.B. Names cannot end with Dot '.', or Space ''.

-- http://dubeyko.com/development/FileSystems/NTFS/ntfsdoc.pdf

ChrisInEdmonton
  • 8,656
  • 7
  • 42
  • 49