Which characters are invalid for an MS-DOS filename?
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I'm writing a filename I/O procedure in x86-16 assembly language. It takes eight characters (I don't need to support long filenames) from the keyboard and prints them to an on-screen text input field.
At the moment i'm allowing numbers, upper/lower-case letters, underscores, and hyphens.
I'd like to allow all legal symbols, but I can't find an official list of banned characters. Common sense tells me that slashes are illegal, but if I had to guess, I would say that the plus character is legal. (edit: It's not!)
I'm already ignoring the period character since my code automatically handles appending the period and file extension.
filenames ms-dos
New contributor
My life is a bug. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
up vote
2
down vote
favorite
I'm writing a filename I/O procedure in x86-16 assembly language. It takes eight characters (I don't need to support long filenames) from the keyboard and prints them to an on-screen text input field.
At the moment i'm allowing numbers, upper/lower-case letters, underscores, and hyphens.
I'd like to allow all legal symbols, but I can't find an official list of banned characters. Common sense tells me that slashes are illegal, but if I had to guess, I would say that the plus character is legal. (edit: It's not!)
I'm already ignoring the period character since my code automatically handles appending the period and file extension.
filenames ms-dos
New contributor
My life is a bug. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2
You might also find Retrocomputing useful.
– Bob
3 hours ago
Try to create a folder in Windows and put a '?' in the name. A tooltip tells you which characters are forbidden. This gives you a start :)...
– Mixxiphoid
47 mins ago
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I'm writing a filename I/O procedure in x86-16 assembly language. It takes eight characters (I don't need to support long filenames) from the keyboard and prints them to an on-screen text input field.
At the moment i'm allowing numbers, upper/lower-case letters, underscores, and hyphens.
I'd like to allow all legal symbols, but I can't find an official list of banned characters. Common sense tells me that slashes are illegal, but if I had to guess, I would say that the plus character is legal. (edit: It's not!)
I'm already ignoring the period character since my code automatically handles appending the period and file extension.
filenames ms-dos
New contributor
My life is a bug. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I'm writing a filename I/O procedure in x86-16 assembly language. It takes eight characters (I don't need to support long filenames) from the keyboard and prints them to an on-screen text input field.
At the moment i'm allowing numbers, upper/lower-case letters, underscores, and hyphens.
I'd like to allow all legal symbols, but I can't find an official list of banned characters. Common sense tells me that slashes are illegal, but if I had to guess, I would say that the plus character is legal. (edit: It's not!)
I'm already ignoring the period character since my code automatically handles appending the period and file extension.
filenames ms-dos
filenames ms-dos
New contributor
My life is a bug. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
My life is a bug. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited 8 mins ago
New contributor
My life is a bug. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 6 hours ago


My life is a bug.
1336
1336
New contributor
My life is a bug. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
My life is a bug. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
My life is a bug. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2
You might also find Retrocomputing useful.
– Bob
3 hours ago
Try to create a folder in Windows and put a '?' in the name. A tooltip tells you which characters are forbidden. This gives you a start :)...
– Mixxiphoid
47 mins ago
add a comment |Â
2
You might also find Retrocomputing useful.
– Bob
3 hours ago
Try to create a folder in Windows and put a '?' in the name. A tooltip tells you which characters are forbidden. This gives you a start :)...
– Mixxiphoid
47 mins ago
2
2
You might also find Retrocomputing useful.
– Bob
3 hours ago
You might also find Retrocomputing useful.
– Bob
3 hours ago
Try to create a folder in Windows and put a '?' in the name. A tooltip tells you which characters are forbidden. This gives you a start :)...
– Mixxiphoid
47 mins ago
Try to create a folder in Windows and put a '?' in the name. A tooltip tells you which characters are forbidden. This gives you a start :)...
– Mixxiphoid
47 mins ago
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
6
down vote
accepted
According to wikipedia
Legal characters for DOS filenames include the following:
- Upper case letters
A
–Z
- Numbers
0
–9
- Space (though trailing spaces in either the base name or the extension are considered to be padding and not a part of the filename, also filenames with spaces in them must be enclosed in quotes to be used on a DOS command line, and if the DOS command is built programatically, the filename must be enclosed in quadruple quotes when viewed as a variable within the program building the DOS command.)
! # $ % & ' ( ) - @ ^ _ ` ~
- Values 128–255 (though if NLS services are active in DOS, some characters interpreted as lowercase are invalid and unavailable)
This excludes the following ASCII characters:
" * + , / : ; < = > ? [ ] |
[9]
- Windows/MS-DOS has no shell escape character
.
(U+002E . full stop) within name and extension fields, except in . and .. entries (see below)
- Lower case letters
a
–z
(stored as A–Z on FAT12/FAT16)
- Control characters 0–31
- Value 127 (DEL)[dubious – discuss]
https://en.wikipedia.org/wiki/8.3_filename#Directory_table
add a comment |Â
up vote
2
down vote
Found this in a manual for MS-DOS 3.3, i'm running 6.22, but it probably still applies.
I was wrong about '+' being allowed.
New contributor
My life is a bug. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
up vote
0
down vote
Strictly speaking, as an MS/PC/DR-DOS applications programmer you are supposed to ask the operating system for this information. INT 0x21 with AX=0x6505 returns a pointer to the so-called FCHAR
NLS table for your country and code page. This table lists a range of characters and a further set of characters that terminate filenames.
In theory it varies by country and code page. But the fact that it was not formally carried over into the OS/2 Control Program API and the fact that FreeDOS has 1 table across all codepages and countries show that it is largely invariant in practice.
Further reading
- http://ctyme.com/intr/rb-3163.htm
- http://ctyme.com/intr/rb-3163.htm#Table1754
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
6
down vote
accepted
According to wikipedia
Legal characters for DOS filenames include the following:
- Upper case letters
A
–Z
- Numbers
0
–9
- Space (though trailing spaces in either the base name or the extension are considered to be padding and not a part of the filename, also filenames with spaces in them must be enclosed in quotes to be used on a DOS command line, and if the DOS command is built programatically, the filename must be enclosed in quadruple quotes when viewed as a variable within the program building the DOS command.)
! # $ % & ' ( ) - @ ^ _ ` ~
- Values 128–255 (though if NLS services are active in DOS, some characters interpreted as lowercase are invalid and unavailable)
This excludes the following ASCII characters:
" * + , / : ; < = > ? [ ] |
[9]
- Windows/MS-DOS has no shell escape character
.
(U+002E . full stop) within name and extension fields, except in . and .. entries (see below)
- Lower case letters
a
–z
(stored as A–Z on FAT12/FAT16)
- Control characters 0–31
- Value 127 (DEL)[dubious – discuss]
https://en.wikipedia.org/wiki/8.3_filename#Directory_table
add a comment |Â
up vote
6
down vote
accepted
According to wikipedia
Legal characters for DOS filenames include the following:
- Upper case letters
A
–Z
- Numbers
0
–9
- Space (though trailing spaces in either the base name or the extension are considered to be padding and not a part of the filename, also filenames with spaces in them must be enclosed in quotes to be used on a DOS command line, and if the DOS command is built programatically, the filename must be enclosed in quadruple quotes when viewed as a variable within the program building the DOS command.)
! # $ % & ' ( ) - @ ^ _ ` ~
- Values 128–255 (though if NLS services are active in DOS, some characters interpreted as lowercase are invalid and unavailable)
This excludes the following ASCII characters:
" * + , / : ; < = > ? [ ] |
[9]
- Windows/MS-DOS has no shell escape character
.
(U+002E . full stop) within name and extension fields, except in . and .. entries (see below)
- Lower case letters
a
–z
(stored as A–Z on FAT12/FAT16)
- Control characters 0–31
- Value 127 (DEL)[dubious – discuss]
https://en.wikipedia.org/wiki/8.3_filename#Directory_table
add a comment |Â
up vote
6
down vote
accepted
up vote
6
down vote
accepted
According to wikipedia
Legal characters for DOS filenames include the following:
- Upper case letters
A
–Z
- Numbers
0
–9
- Space (though trailing spaces in either the base name or the extension are considered to be padding and not a part of the filename, also filenames with spaces in them must be enclosed in quotes to be used on a DOS command line, and if the DOS command is built programatically, the filename must be enclosed in quadruple quotes when viewed as a variable within the program building the DOS command.)
! # $ % & ' ( ) - @ ^ _ ` ~
- Values 128–255 (though if NLS services are active in DOS, some characters interpreted as lowercase are invalid and unavailable)
This excludes the following ASCII characters:
" * + , / : ; < = > ? [ ] |
[9]
- Windows/MS-DOS has no shell escape character
.
(U+002E . full stop) within name and extension fields, except in . and .. entries (see below)
- Lower case letters
a
–z
(stored as A–Z on FAT12/FAT16)
- Control characters 0–31
- Value 127 (DEL)[dubious – discuss]
https://en.wikipedia.org/wiki/8.3_filename#Directory_table
According to wikipedia
Legal characters for DOS filenames include the following:
- Upper case letters
A
–Z
- Numbers
0
–9
- Space (though trailing spaces in either the base name or the extension are considered to be padding and not a part of the filename, also filenames with spaces in them must be enclosed in quotes to be used on a DOS command line, and if the DOS command is built programatically, the filename must be enclosed in quadruple quotes when viewed as a variable within the program building the DOS command.)
! # $ % & ' ( ) - @ ^ _ ` ~
- Values 128–255 (though if NLS services are active in DOS, some characters interpreted as lowercase are invalid and unavailable)
This excludes the following ASCII characters:
" * + , / : ; < = > ? [ ] |
[9]
- Windows/MS-DOS has no shell escape character
.
(U+002E . full stop) within name and extension fields, except in . and .. entries (see below)
- Lower case letters
a
–z
(stored as A–Z on FAT12/FAT16)
- Control characters 0–31
- Value 127 (DEL)[dubious – discuss]
https://en.wikipedia.org/wiki/8.3_filename#Directory_table
answered 5 hours ago


phuclv
8,04643385
8,04643385
add a comment |Â
add a comment |Â
up vote
2
down vote
Found this in a manual for MS-DOS 3.3, i'm running 6.22, but it probably still applies.
I was wrong about '+' being allowed.
New contributor
My life is a bug. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
up vote
2
down vote
Found this in a manual for MS-DOS 3.3, i'm running 6.22, but it probably still applies.
I was wrong about '+' being allowed.
New contributor
My life is a bug. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
up vote
2
down vote
up vote
2
down vote
Found this in a manual for MS-DOS 3.3, i'm running 6.22, but it probably still applies.
I was wrong about '+' being allowed.
New contributor
My life is a bug. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Found this in a manual for MS-DOS 3.3, i'm running 6.22, but it probably still applies.
I was wrong about '+' being allowed.
New contributor
My life is a bug. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
My life is a bug. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
answered 6 hours ago


My life is a bug.
1336
1336
New contributor
My life is a bug. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
My life is a bug. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
My life is a bug. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
add a comment |Â
up vote
0
down vote
Strictly speaking, as an MS/PC/DR-DOS applications programmer you are supposed to ask the operating system for this information. INT 0x21 with AX=0x6505 returns a pointer to the so-called FCHAR
NLS table for your country and code page. This table lists a range of characters and a further set of characters that terminate filenames.
In theory it varies by country and code page. But the fact that it was not formally carried over into the OS/2 Control Program API and the fact that FreeDOS has 1 table across all codepages and countries show that it is largely invariant in practice.
Further reading
- http://ctyme.com/intr/rb-3163.htm
- http://ctyme.com/intr/rb-3163.htm#Table1754
add a comment |Â
up vote
0
down vote
Strictly speaking, as an MS/PC/DR-DOS applications programmer you are supposed to ask the operating system for this information. INT 0x21 with AX=0x6505 returns a pointer to the so-called FCHAR
NLS table for your country and code page. This table lists a range of characters and a further set of characters that terminate filenames.
In theory it varies by country and code page. But the fact that it was not formally carried over into the OS/2 Control Program API and the fact that FreeDOS has 1 table across all codepages and countries show that it is largely invariant in practice.
Further reading
- http://ctyme.com/intr/rb-3163.htm
- http://ctyme.com/intr/rb-3163.htm#Table1754
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Strictly speaking, as an MS/PC/DR-DOS applications programmer you are supposed to ask the operating system for this information. INT 0x21 with AX=0x6505 returns a pointer to the so-called FCHAR
NLS table for your country and code page. This table lists a range of characters and a further set of characters that terminate filenames.
In theory it varies by country and code page. But the fact that it was not formally carried over into the OS/2 Control Program API and the fact that FreeDOS has 1 table across all codepages and countries show that it is largely invariant in practice.
Further reading
- http://ctyme.com/intr/rb-3163.htm
- http://ctyme.com/intr/rb-3163.htm#Table1754
Strictly speaking, as an MS/PC/DR-DOS applications programmer you are supposed to ask the operating system for this information. INT 0x21 with AX=0x6505 returns a pointer to the so-called FCHAR
NLS table for your country and code page. This table lists a range of characters and a further set of characters that terminate filenames.
In theory it varies by country and code page. But the fact that it was not formally carried over into the OS/2 Control Program API and the fact that FreeDOS has 1 table across all codepages and countries show that it is largely invariant in practice.
Further reading
- http://ctyme.com/intr/rb-3163.htm
- http://ctyme.com/intr/rb-3163.htm#Table1754
answered 6 mins ago
JdeBP
22k14885
22k14885
add a comment |Â
add a comment |Â
My life is a bug. is a new contributor. Be nice, and check out our Code of Conduct.
My life is a bug. is a new contributor. Be nice, and check out our Code of Conduct.
My life is a bug. is a new contributor. Be nice, and check out our Code of Conduct.
My life is a bug. is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1362080%2fwhich-characters-are-invalid-for-an-ms-dos-filename%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
2
You might also find Retrocomputing useful.
– Bob
3 hours ago
Try to create a folder in Windows and put a '?' in the name. A tooltip tells you which characters are forbidden. This gives you a start :)...
– Mixxiphoid
47 mins ago