Freigeben über


SET DEFAULT Command

Specifies the default drive and directory.

SET DEFAULT TO [cPath]

Parameters

  • cPath
    Specifies one of the following:
    • A drive designator.
    • A drive designator with a directory name.
    • A child directory name.
    • Any of the above using Microsoft MS-DOS shorthand notation ( \ or ..).

Remarks

SET DEFAULT changes the default directory to the directory you specify.

Microsoft® Visual FoxPro® searches for a file in the default Visual FoxPro directory. The default directory is the one from which you start Visual FoxPro. However, you can specify a different default directory in your Visual FoxPro configuration file or in a startup program. 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 don't specify where to place it, the file is placed in the default Visual FoxPro directory.

In multithreaded servers, SET DEFAULT affects an entire process. That is, if you have instantiated multiple threads, and you use SET DEFAULT TO "MYDIR" in one thread, it affects all the threads and the process that objects are loaded in.

When you quit Visual FoxPro, you are returned to Microsoft® Windows®. When you exit Windows, you are returned to the drive and directory from which you started Windows.

Tip   SYS(5) returns the default drive. SYS(2003) returns the default directory with no drive designator. SYS(5) + SYS(2003) returns the default drive and the directory.

You can change the default drive to drive A using either of the following commands:

SET DEFAULT TO A
SET DEFAULT TO A:

You can specify a specific directory:

SET DEFAULT TO A:\sales
SET DEFAULT TO C:\sales\data

You can specify a child directory. If the root directory on drive C is the default Visual FoxPro directory, issue the following command to change the default directory to C:\Sales:

SET DEFAULT TO sales

You can use MS-DOS shorthand notation. If the current directory is C:\Sales\Data, issue the following command to make the root directory the default directory:

SET DEFAULT TO \

You can also move the default directory one directory toward the root directory with the following command:

SET DEFAULT TO ..

See Also

CD | CHDIR | MD | MKDIR | RD | RMDIR | SET PATH | SYS(5) – Default Drive | SYS(2003) – Current Directory