>Hey, ( Side Bar ) I recently moved to NC
>
> Ill experiment with your idea.
>
> Here is the specific situation.
>
> They are running Fox 2.6 Windows on Windows '98 ( Don't even ask why)
> Recently they have moved to Windows 2k Still Fox 2.6
>
> Code may have macros in the picture.
>
> example
> OldFile = 'c:\windows\test.txt'
> NewFile = 'C:\mydir\newtest_on_my_directory.txt'
>
> run copy &OldFile to &NewFile
>
> It does not complete the copy command.
>
> Any additional feedback would be helpfull
First, the DOS COPY command does not take a 'to' intermediary - the syntax would be something like:
RUN COPY &OldFile &NewFile
but that isn't going to work...
COPY is an internal command - there is no COPY.COM or COPY.EXE for RUN to execute. The easiest ways to address this are (1) to explicitly launch a new instance of the CLI, or (2) encapsulate the command in a batch file, and use RUN to fire the .BAT file. Other options exist - using a COM option like the WSH Scripting.FileSystemObject or Shell.Application to perform the copy operation, use of the VFP COPY FILE command, or any of several Win API calls like CopyFile() or SHFileOperation() to replace the DOS command under RUN are all probably worth considering.
Explicitly starting a new CLI instance would involve something lile:
RUN COMMAND /C COPY &OldFile &NewFile
Creating a Batch file and running it under VFP 6 or VFP 7:
=STRTOFILE("COPY " + OldFile + " " + NewFile,'TEMP.BAT')
RUN Temp.BAT
ERASE Temp.BAT
The other suggestions such as using the WSH Scripting.FileSystemObject or Shell.Application offer a wide range of alternatives to COPY without a DOS Box (you can substitute my API_APPRUN class in the Download section for RUN to avoid the DOS box, or create a .PIF to hide it, too) as do the Win API calls. Almost anything is better than using the command line COPY command.