Microsoft KB Archive/94783

= Basic Products Can Create and Use Non-Standard File Names =

Article ID: 94783

Article Last Modified on 8/16/2005

-

APPLIES TO


 * Microsoft Visual Basic 2.0 Standard Edition
 * Microsoft Visual Basic 3.0 Professional Edition
 * Microsoft Visual Basic 2.0 Professional Edition
 * Microsoft Visual Basic 3.0 Professional Edition
 * Microsoft Visual Basic 1.0 Standard Edition
 * Microsoft Visual Basic for MS-DOS
 * Microsoft Cinemania 97 Standard Edition
 * Microsoft QuickBasic 4.5 for MS-DOS

-



This article was previously published under Q94783



SUMMARY
Microsoft Visual Basic and other Basic products can create and use non-standard MS-DOS file names. For example, a file name with an embedded space is a non-standard file name. However, Microsoft doesn't recommend that you use non-standard file names because they can cause problems with other software.



MORE INFORMATION
According to the MS-DOS documentation, file names must:


 * Have no more than eight characters.
 * Contain only the letters A through Z, the numbers 0 through 9, and the following special characters: underscore (_), caret (^), dollar sign ($), tilde (~), exclamation point (!), number sign (#), percent sign (%), ampersand (&), hyphen (-), braces ({}), parentheses, at sign (@), apostrophe ('), and the accent grave (`). No other special characters are acceptable.
 * Not contain spaces, commas, backslashes, or periods except for the period that separates the name from the extension.
 * Not be the following reserved filenames: CLOCK$, CON, AUX, COMn (where n=1-4), LPTn (where n=1-3), NUL, and PRN.

The Basic OPEN command allows you to open a file name that breaks some of these rules. For example, you can open a file that has a space embedded in its name.

The following example creates a file giving it a name that contains a space. Then it writes data to the file, reopens it, and prints the data on the screen: OPEN &quot;A B&quot; FOR OUTPUT AS #1 'There is a space between A and B PRINT #1, &quot;HELLO THERE&quot; CLOSE #1

OPEN &quot;A B&quot; FOR INPUT AS #1 INPUT #1, A$ PRINT A$  CLOSE #1

Additional query words: 2.00 3.00 4.50 7.10

Keywords: KB94783

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.