Partilhar via


How to: Specify the Configuration File

When Visual FoxPro starts, you can specify a configuration file or bypass all configuration files, allowing Visual FoxPro to use its default settings.

When Visual FoxPro loads a configuration file, the settings in that file take precedence over corresponding default settings made in the Options dialog box.

To specify a configuration file

  • In the command line that starts Visual FoxPro, specify the -C switch and the name of the configuration file that you want to use (including a path if necessary). Do not put a space between the switch and the file name.

    -or-

  • In Windows, double-click the name of the configuration file to use. Visual FoxPro will start using the configuration file you have selected.

If you want to avoid using any configuration file, including the default file Config.fpw, you can suppress all configuration files. This causes Visual FoxPro to use only the default settings established in the Options dialog box.

To suppress a configuration file

  • In the command line that starts Visual FoxPro, add the -C switch with nothing after it.

    For example, to avoid any configuration file found in the startup directory or the system path, use this command line:

    VFPVersionNumber.exe -C
    

Specifying an External Configuration File

You can use an external configuration file in addition to an internal configuration file in circumstances where you need to configure settings separately. For example, setting SCREEN=OFF should be performed in an internal configuration file.

You can set Visual FoxPro to read an external configuration file following an internal configuration file by using the new ALLOWEXTERNAL directive in the internal configuration file. When you include the setting ALLOWEXTERNAL=ON in the internal configuration file, Visual FoxPro searches for an external configuration file, usually Config.fpw, and reads its settings. You can also specify a different configuration file using the -C command-line switch when starting Visual FoxPro.

Note

For .exe and .dll file servers, Visual FoxPro supports only those configuration files bound inside the server. Therefore, Visual FoxPro disregards the ALLOWEXTERNAL setting.

To read an external configuration file after an internal one

  1. In the internal configuration file, set the special term ALLOWEXTERNAL to on.

    ALLOWEXTERNAL = ON
    
  2. When you start your program, either specify a second configuration file using the -C command-line switch or have a second configuration file in the default program path.

For more information about command-line switches, see How to: Use Command-Line Options When Starting Visual FoxPro.

The settings in an external configuration file take precedence over those in the internal configuration file, if duplicate settings exist, because the external configuration file is read after the internal file. Visual FoxPro does not begin initialization until it reads both files.

If you want to specify the configuration file as read-only, place the file in your project and mark it as Included. If you want to specify that the file can be modified, place the file in your project and mark it as Excluded. You can then distribute the file separately with your application or executable file. By convention, configuration files use the .fpw extension.

See Also

Tasks

How to: Use Command-Line Options When Starting Visual FoxPro
How to: Add Setup Code to a Menu System

Reference

_STARTUP System Variable

Concepts

Setting Configuration Options at Startup

Other Resources

Compiling an Application
Designing Menus and Toolbars
Visual FoxPro Environment Settings