Categories


Authors

How to work around Windows' restricted characters

The problem

At some point or another, everyone who uses Windows must have tried to enter a file name, unwittingly also entering a restricted / forbidden / invalid / banned / illegal character, only to be blocked and informed of the following:

A file name can’t contain any of the following characters:
\ / : * ? ” < > |

Personally, I’ve always found it irritating to have such common punctuation disallowed.

 

The explanation

Basically, Windows blocks these characters from being used in file names because the same characters are used in its coding so it would get tripped up otherwise. Unix-based Operating Systems such as macOS also have forbidden characters for the same reason but they’re significantly fewer.

What many people don’t know is that Windows’ file names support the Unicode character set and it only blocks the ASCII printable character versions:

Symbol Name Hex code Decimal code
\ Backslash 5C 92
/ Slash / divide 2F 47
: Colon 3A 58
* Asterisk 2A 42
? Question mark 3F 63
" Double quotes / speech marks 22 34
< Less than / open angled bracket 3C 60
> Greater than / close angled bracket 3E 62
| Vertical bar / pipe 7C 124

So, what if you could find Unicode characters that look like the “original” characters but aren’t technically the same…? Spoiler: you can.

 

The workaround

Using https://unicode-search.net/unicode-namesearch.pl?term=, I have found Unicode characters that look like the original characters but aren’t the same so they can be used in Windows file names!

Symbol Name Unicode code
\ Reverse Solidus Operator U+29F5
Division Slash U+2215
Modifier Letter Colon U+A789
Low Asterisk U+204E
Fullwidth Question Mark U+FF1F
Left Double Quotation Mark U+201C
Right Double Quotation Mark U+201D
Fullwidth Less-Than Sign U+FF1C
Fullwidth Greater-Than Sign U+FF1E
Vertical Line Extension U+23D0

So, how can you type these?

Edit: For a significantly better version of the below, I now use an AutoHotkey script which automatically replaces the characters when File Explorer windows are open so you don’t have to remember key combinations. This is available in my other blog post Windows apps for an efficient workflow.

Personally, I use AutoHotkey and the following custom script (.AHK file) so that all I have to do is press left Alt (LAlt) or right Alt (RAlt) and the normal key:

; Configuration
	#EscapeChar `

; Back slash (⧵)
	LAlt & \::SendInput {U+29F5}
	
; Forward slash (∕)
	LAlt & /::SendInput {U+2215}
	
; Colon (꞉)
	LAlt & `;::SendInput {U+A789}
	
; Asterisk (⁎)
	LAlt & 8::SendInput {U+204E}
	
; Question mark (?)
	RAlt & ?::SendInput {U+FF1F}
	
; Quotation / speech marks (“)
	RAlt & 2::SendInput {U+201C}
	
; Quotation / speech marks (”)
	LAlt & 2::SendInput {U+201D}

; Less than sign (<)
	RAlt & <::SendInput {U+FF1C}

; Greater than sign (>)
	RAlt & >::SendInput {U+FF1E}

; Vertical line (⏐)
	RAlt & |::SendInput {U+23D0}

; Date with Unicode thin spaces (U+2009) and forward slashes (U+2215)
	LAlt & d::
		FormatTime, Date,, yyyy ∕ MM ∕ dd
		SendInput, %Date%
	return
	
; Time with Unicode colons (U+A789)
	LAlt & t::
		FormatTime, Time,, HH꞉mm꞉ss
		SendInput, %Time%
	return

; Right arrow (→)
	LAlt & Right::SendInput {U+2192}

; Left arrow (←)
	LAlt & Left::SendInput {U+2190}

; Up arrow (↑)
	LAlt & Up::SendInput {U+2191}

; Down arrow (↓)
	LAlt & Down::SendInput {U+2193}

Below is a demonstration of this:

I have been using these characters in file names ever since in Dropbox, OneDrive for Business, Microsoft Word, Adobe Reader, etc on Windows, iOS, and web and, as of 2020 ∕ 09 ∕ 10 (😉), I have experienced no compatibility problems.

A proper PowerShell syntax highlighter

Great software 2