Export (0) Print
Expand All
Expand Minimize
0 out of 1 rated this helpful - Rate this topic

CD | CHDIR Command

Changes the default Visual FoxPro directory to the directory you specify.


CD cPath | CHDIR cPath

Parameters

cPath

Specifies one of the following:

  • A drive designator

  • A drive designator with a directory

  • A child directory

  • Any of the above using MS-DOS shorthand notation ( \ or ..). When you include .. to change to the parent directory, you must include a space between CD or CHDIR and the two periods.

Use CD or CHDIR to specify the default Visual FoxPro directory. Visual FoxPro searches for files in the default Visual FoxPro directory. If Visual FoxPro cannot find a file in the default directory, it then searches the Visual FoxPro path if one has been specified. Use SET PATH to specify the Visual FoxPro path.

If you create a file and do not specify where to place it, the file is placed in the default Visual FoxPro directory.

You can locate hidden or system directories using CD and CHDIR. For more information, see FILE( ) Function and DIRECTORY( ) Function.

The CD and CHDIR commands are not supported in either single or multithreaded DLL servers. These commands change the default directory of the entire process, so all threads which are part of the process are affected. Use the SET PATH command in DLL servers, in place of SET DEFAULT.

The following example uses SET DEFAULT to change the default Visual FoxPro directory to the startup directory. It uses MKDIR to create a new directory named mytestdir, and CHDIR changes to the mytestdir directory. GETDIR( ) shows you the directory structure in the Select Directory dialog box. You can then use SET DEFAULT to move your position back to the startup directory, RMDIR to remove the newly created directory, and GETDIR( ) to display the original directory structure.

SET DEFAULT TO HOME()  
MKDIR mytestdir  
CHDIR mytestdir  = GETDIR()  
SET DEFAULT TO HOME()  
RMDIR mytestdir  = GETDIR()  
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.