Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Fox Pro and Dos under windows 2k
Message
From
21/06/2002 23:46:44
 
 
To
21/06/2002 18:03:24
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00671184
Message ID:
00671308
Views:
13
>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.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform