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.

8
  • Just curious: what do you need it for? Aug 10, 2016 at 19:45
  • @ kamil This is for give name of my file/folder, and one challenging task for me. Aug 10, 2016 at 19:49
  • @ PIMP_JUICE_IT I already did it, (literalString -literalPath but still not get success. Aug 10, 2016 at 19:53
  • 13
    – How can I lick my elbow? – You can't. – But I have to. – You can break your arm and try but your arm will be useless then. – I don't care, I just need to lick my elbow. Aug 10, 2016 at 20:15
  • 1
    @LonnieBest Congratulations, you have licked a prosthetic elbow. Apr 24, 2020 at 18:37

3 Answers 3

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

16
  • 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. Aug 10, 2016 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, 2016 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 Aug 10, 2016 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, 2016 at 20:01
  • 3
    @Kirit I already told you it is not possible.
    – DavidPostill
    Aug 10, 2016 at 20:31
4

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

3
  • 1
    That or using lookalike characters. With Unicode, anything is possible. 🎃
    – Daniel B
    Aug 10, 2016 at 21:05
  • @ Craig620 May be it will not possible, for me. can give me some hint for it. Aug 11, 2016 at 5:40
  • Not sure, just a crazy idea that came to mind. Maybe there is a Stack Exchange forum for typography or publishing you could ask?
    – Clayton
    Aug 11, 2016 at 15:23
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

9
  • NTFS is not the problem. (In fact it allows these characters just fine – it had to, for Interix support.) The problem is Windows itself, that is, the restrictions are imposed by Win32 APIs no matter what the underlying FS is.
    – user1686
    Aug 10, 2016 at 19:25
  • @grawity, you appear to be correct based on my further investigations. I have edited my answer to reflect this. Aug 10, 2016 at 19:30
  • I think NTFS is not problem. It must have some solution. When i access NTFS drive from Linux based O.S than may be i can type these type of characters. Aug 10, 2016 at 19:33
  • "Names cannot end with Dot". Incorrect. You can file names ending in .. You just can't do much with them from cmd :)
    – DavidPostill
    Aug 10, 2016 at 19:49
  • 1
    @Kirit You have been told many times it is not possible.
    – DavidPostill
    Aug 10, 2016 at 20:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.