Which characters are invalid for an MS-DOS filename?

The name of the pictureThe name of the pictureThe name of the pictureClash 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.










share|improve this question









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














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.










share|improve this question









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












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.










share|improve this question









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






share|improve this question









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.











share|improve this question









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.









share|improve this question




share|improve this question








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












  • 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










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






share|improve this answer



























    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.



    enter image description here






    share|improve this answer








    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.
























      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




      share




















        Your Answer







        StackExchange.ready(function()
        var channelOptions =
        tags: "".split(" "),
        id: "3"
        ;
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function()
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled)
        StackExchange.using("snippets", function()
        createEditor();
        );

        else
        createEditor();

        );

        function createEditor()
        StackExchange.prepareEditor(
        heartbeatType: 'answer',
        convertImagesToLinks: true,
        noModals: false,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        );



        );






        My life is a bug. is a new contributor. Be nice, and check out our Code of Conduct.









         

        draft saved


        draft discarded


















        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






























        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






        share|improve this answer
























          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






          share|improve this answer






















            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






            share|improve this answer












            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







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 5 hours ago









            phuclv

            8,04643385




            8,04643385






















                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.



                enter image description here






                share|improve this answer








                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.





















                  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.



                  enter image description here






                  share|improve this answer








                  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.



















                    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.



                    enter image description here






                    share|improve this answer








                    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.



                    enter image description here







                    share|improve this answer








                    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.









                    share|improve this answer



                    share|improve this answer






                    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.




















                        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




                        share
























                          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




                          share






















                            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




                            share












                            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





                            share











                            share


                            share










                            answered 6 mins ago









                            JdeBP

                            22k14885




                            22k14885




















                                My life is a bug. is a new contributor. Be nice, and check out our Code of Conduct.









                                 

                                draft saved


                                draft discarded


















                                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.













                                 


                                draft saved


                                draft discarded














                                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













































































                                Comments

                                Popular posts from this blog

                                What does second last employer means? [closed]

                                List of Gilmore Girls characters

                                Confectionery