Compartir a través de


How to: Create a Configuration File

To create a configuration file, use the Visual FoxPro editor, or any editor that can create text files, to create a text file in the directory where Visual FoxPro is installed. Earlier versions of Visual FoxPro created the file Config.fpw in the startup directory. Config.fpw became the default configuration file. You can create any program file and use it to establish default settings and behaviors by starting Visual FoxPro using that file either by double clicking the file or using a command line reference.

If you are creating a new configuration file, you can save it using any name you want. By convention, configuration files have the extension .fpw.

When you start Visual FoxPro, you can use a default configuration file from the following locations in order:

  • Current working directory

  • Directory where Visual FoxPro is installed

  • Directories listed in the DOS path

If Visual FoxPro does not find a configuration file in these locations, Visual FoxPro uses only the default settings established in the Options dialog box.

Note

For details about specifying an alternative to the default file name or location for the configuration file, see How to: Specify the Configuration File.

Enter configuration settings using one of these methods:

  • Make settings with the SET command.

  • Set system variables.

  • Call programs or functions.

  • Include special terms used only in configuration files.

To enter SET commands in a configuration file

  • Enter SET commands without the SET keyword and with an equal sign.

    For example, to set a default path type, use this format:

    DEFAULT = HOME()+"\VFP"
    

    To add a clock to the status bar, use this command:

    CLOCK = ON
    

To enter a setting for a system variable, use the same syntax you would use in the Command window or in a program.

To set system variables in a configuration file

  • Enter the name of the system variable, an equal sign (=), and the value to set the variable to.

    For example, the following command specifies an alternative spell-checking program:

    _SPELLCHK = "SPLLCHK.EXE"
    

You can also call functions or execute programs from within a configuration file by using the COMMAND command. For example, you can start an initialization program as part of the startup process.

To call functions or execute commands in a configuration file

  • Enter COMMAND, an equal sign (=), and the command to execute or function to call.

    For example, to include the Visual FoxPro version number in the caption of the main Visual FoxPro window, use this command:

    COMMAND =_SCREEN.Caption="Visual FoxPro " + VERS(4)
    

    The following command launches a specific application when Visual FoxPro starts:

    COMMAND = DO MYAPP.APP
    

You can also use special terms in a configuration file that do not correspond to SET value, system variables, or commands.

To use special terms in a configuration file

  • Enter the special term, an equal sign (=), and the setting.

    For example, to set the maximum number of variables available in Visual FoxPro, use this command:

    MVCOUNT = 2048
    

For a complete list of special terms for configuration files, see Special Terms for Configuration Files.

Starting Applications or Programs Automatically

You can insert commands into a configuration file that automatically launches programs when Visual FoxPro starts. You can use these commands either to start an entire application or to start just a program, such as one that initializes system variables.

To start applications from a configuration file

  1. Assign the name of your application to the _STARTUP System Variable anywhere in the configuration file:

    _STARTUP = MYAPP.APP
    

    -or-

  2. Use the COMMAND command, which must be the last line in your configuration file:

    COMMAND = DO MYAPP.APP
    

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