VB CURDIR$ Function Not Reliable to Determine Program Location

ID: Q80611


The information in this article applies to:
  • Microsoft Visual Basic Standard and Professional Editions for Windows, versions 2.0, 3.0
  • Microsoft Visual Basic programming system for Windows, version 1.0


SUMMARY

The CURDIR$ function returns the path to the current directory on the currently selected drive. Because the current directory is not necessarily the directory where the current Visual Basic program resides, the CURDIR$ function is not a reliable means for determining the location of the currently executing program. This information applies to the CURDIR$ function, and to the drive list box, directory list box, and file list box controls in Visual Basic.


MORE INFORMATION

You can use any of the following methods to start a program under Windows:

  • From the MS-DOS prompt, type:
    WIN drive:\pathname\program name


  • From Windows Program Manager, choose Run from the File menu, and enter the full pathname of the executable program.


  • From Windows File Manager, choose Run from the File menu, and enter the full path of the executable program.


  • From Windows Program Manager, choose New from the File menu, and create a new program item for the executable program. Double-click the resulting icon.


  • From Windows File Manager, use the mouse to choose the appropriate drive and directory containing the executable file, and double-click the executable filename.


If the program is launched using the first, third, or fifth method above, the CURDIR$ value will return the current directory at the time Windows was launched or at the time the program was started from File Manager. The current directory can be checked by opening File Manager and reading the current directory from the bar below the drive buttons; for the fifth method, the File Manager's current directory will actually be the directory where the started program resides.

If the program is launched using the second method from the Windows Program Manager, the CURDIR$ value will be the path to the location of the program that was started.

If the program is launched using the fourth method, the CURDIR$ value is the working directory you specified for the icon, or if you left the working directory blank, CURDIR$ returns the Windows directory.

NOTE: The current directory of an MS-DOS session does not necessarily indicate the current directory that will be returned by CURDIR$.

Additional query words: 2.00 3.00

Keywords :
Version :
Platform :
Issue type :


Last Reviewed: September 16, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.