PRB: DO <Program Name> Runs Cached Version of ProgramLast reviewed: January 10, 1997Article ID: Q156342 |
The information in this article applies to:
SYMPTOMSIf you run a program file, change the default directory, and then attempt to run a different program of the same name from that directory, the first program runs again.
CAUSEFor performance purposes, program or procedure code is cached in memory. The version in memory is used when the same procedure or program name is executed again.
WORKAROUNDUse the CLEAR PROGRAM command before running the second program of the same name. -or- Reference the program explicitly by path, for example:
DO .\<progname> STATUSThis behavior is by design.
MORE INFORMATION
Steps to Reproduce BehaviorRun the following code from a program (.prg) file:
* Start of code example * LOCAL lcCurDir, lnI lcCurDir=SET('default')+CURDIR() && Save the current directory CLEAR MD c:\testxx && Make the new directory FOR lnI = 1 TO 2 MD 'c:\testxx\t'+ALLTRIM(STR(lnI)) && Make one of the subdirs CD 'c:\testxx\t'+ALLTRIM(STR(lnI)) && Change to it * Put the program code into the clipboard _CLIPTEXT = '? " This is in My_Prog from T'+ALLTRIM(STR(lnI))+'"' KEYBOARD '{ctrl + v}' && This will paste it into the program KEYBOARD '{ctrl + w}' && This will close the editor MODIFY COMMAND My_Prog && Open the editor - then the above 2 && keystrokes will be processed DO My_Prog && Run the program ENDFOR FOR lnI = 1 TO 2 CD 'c:\testxx\t'+ALLTRIM(STR(lnI)) && Change to one of the subirs DELETE FILE My_Prog.FXP && Delete the .PRG/.FXP file DELETE FILE My_Prog.PRG CD .. RD 'c:\testxx\t'+ALLTRIM(STR(lnI)) && Remove the subdir ENDFOR CD (lcCurDir) && Switch to the original default RD c:\testxx && Remove the directory * * End of code exampleBoth messages printed to the FoxPro desktop refer to the T1 directory. Demonstration of Workaround 1:
|
KBCategory: kbprg kbprb
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |