# BUG: Parameters Passed with Hyphen to Executable are Ignored

ID: Q124776

The information in this article applies to:

- Microsoft FoxPro for Windows, version 2.6a
- Microsoft FoxPro for MS-DOS, version 2.6a

## SYMPTOMS

A FoxPro stand-alone executable ignores parameters passed to it if they are preceded by a hyphen, even if the whole expression is enclosed in quotes. The subsequent parameters (if any) are shifted to the left.

## RESOLUTION

Pass the parameters with a different preceding character. Some valid characters are:

- Forward slash: /
- Pound sign: #
- Left parenthesis: (
- Right parenthesis: )

## STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

## MORE INFORMATION

### Steps to Reproduce Problem

1. Create a new project by using the File menu.

2. In the project window, choose New; then choose program.

3. In the newly created program window, type the following code:

       PARAMETERS n1, n2, n3, n4

       WAIT WINDOW "Parameters received: " + LTRIM(STR(PARAMETERS()))
       WAIT WINDOW IIF(TYPE("n1")=="N", STR(n1), n1)
       WAIT WINDOW IIF(TYPE("n2")=="N", STR(n2), n2)
       WAIT WINDOW IIF(TYPE("n3")=="N", STR(n3), n3)
       WAIT WINDOW IIF(TYPE("n4")=="N", STR(n4), n4)

4. Press CTRL+W to close and save this program. When prompted for a name,

       enter MYFILE.PRG.

5. In the project window, choose build. Then choose build executable. The

       type of executable in FoxPro for MS-DOS is irrelevant to this example.
       Confirm the subsequent dialogs. When prompted for a name, type MYFILE
       each time.

6. Close FoxPro.

7. Start the executable, passing it four parameters, two of which are

       negative numbers.

        - In FoxPro for MS-DOS, type the following at the MS-DOS prompt
          and press ENTER:

          MYFILE.EXE 5 -6 7 -8

        - In FoxPro for Windows, choose Run from the File menu, and type the
          command line:

          MYFILE.EXE 5 -6 7 -8

8. Note that the first wait window reports that only two parameters were

       passed. The subsequent wait windows show that the executable ignored the
       second and fourth parameters, and shifted the third parameter to the
       left, assigning its value to the second variable. The last two wait
       windows generate errors because they have no variable to display.

Additional reference words: FoxWin FoxDos 2.60a buglist2.60a KBCategory: kbenv kbbuglist KBSubcategory: FxenvOs

Last Reviewed: June 27, 1995 © 1999 Microsoft Corporation. All rights reserved. Terms of Use.