MKDIR Incorrectly Allows Blanks in Pathname in VB for MS-DOS (74864)



The information in this article applies to:

  • Microsoft Visual Basic for MS-DOS
  • Microsoft Basic Professional Development System for MS-DOS 7.0
  • Microsoft Basic Professional Development System for MS-DOS 7.1

This article was previously published under Q74864

SYMPTOMS

The MKDIR statement in Microsoft Visual Basic for MS-DOS, and Microsoft Basic Professional Development System (PDS) for MS-DOS incorrectly allows the creation of a directory with a blank space in it. When you try to change to that directory from the MS-DOS prompt, MS-DOS generates the error "too many parameters."

STATUS

Microsoft has confirmed this to be a bug in the Standard and Professional Editions of Microsoft Visual Basic for MS-DOS, version 1.0; and Microsoft Basic Professional Development System (PDS) for MS-DOS, versions 7.0 and 7.1 (buglist7.00 buglist7.10). Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

The syntax for the MKDIR statement is as follows:

MKDIR pathname$

where "pathname$" is the string variable containing the path specification and directory name to make.

In Visual Basic for MS-DOS and Basic PDS for MS-DOS, the MKDIR statement incorrectly allows the pathname$ to contain a blank or space character. From within the program, you can use the CHDIR statement to change to that directory. However, at the MS-DOS prompt, you cannot change to that directory because of the blank space.

The following steps reproduce the problem:
  1. Compile the following program:
          REM Program name: MAKEDIR.BAS
          MKDIR "C:\test tmp"
  2. Compile as follows:
          BC MAKEDIR.BAS;
          LINK MAKEDIR.BAS;
  3. Run the program by typing MAKEDIR at the MS-DOS prompt to create the directory.
  4. At the "C:\" prompt, type the following command to try to change to the "test tmp" directory:

    cd test tmp

MS-DOS returns the error "Too many parameters - tmp". You can remove this directory with the RMDIR statement. The following statement will remove the directory created in the previous program:

RMDIR "test tmp"

The MKDIR function correctly gives the error "Path Not Found" when other illegal MS-DOS characters such as the '?' and '*' are entered in as the pathname$.

Modification Type:MinorLast Reviewed:8/16/2005
Keywords:KB74864 kbAudDeveloper