How do I check if a given string is a legal/valid file name under Windows?

后端 未结 27 1392
-上瘾入骨i
-上瘾入骨i 2020-11-22 09:38

I want to include a batch file rename functionality in my application. A user can type a destination filename pattern and (after replacing some wildcards in the pattern) I n

27条回答
  •  灰色年华
    2020-11-22 10:26

    To complement the other answers, here are a couple of additional edge cases that you might want to consider.

    • Excel can have problems if you save a workbook in a file whose name contains the '[' or ']' characters. See http://support.microsoft.com/kb/215205 for details.

    • Sharepoint has a whole additional set of restrictions. See http://support.microsoft.com/kb/905231 for details.

提交回复
热议问题