Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vfp 6 in xp shell problem

Status
Not open for further replies.

jonoX

Programmer
Mar 13, 2003
11
IE
I have code from foxpro 2.5 (to copy files from one loacion to another) I migrated to vfp 6 and runs perfectly in 98 but when I run it in xp the ! command is not working correctly ie if the file name is 8 chars or less the command works but if the file name is more than 8 chars it dosn't copy the file to a nw location
 
jonoX

Can you post the code you are using so we may see where the problem is?

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
I have code from foxpro 2.5 (to copy files from one loacion to another) I migrated to vfp 6 and runs perfectly in 98 but when I run it in xp the ! command is not working correctly ie if the file name is 8 chars or less the command works but if the file name is more than 8 chars it dosn't copy the file to a new location

The code takes its file name from a combo box and copies the file with redirection of output to confirm the copy of files, this isconfirmed when the fred.txt is edited

wait wind "Copy from local to network (Y/N)" to manz
dumz=at(".",this.value)
dumz="forms\"+subs(this.value,1,dumz-1)
if upper(manz)="Y"
thisform.sde(this.value)
modi file dechange.txt
if at("FORMS\",upper(dumz))>0
dums="!copy "+dumz+".* h:\jenkwind\wsaddti\forms > FRED.TXT"
ENDIF
KEYBOARD "{CTRL+F2}"
KEYBOARD "&dums"
KEYBOARD "{ENTER}"
endif
 
XP (like NT / 2000 / 2003) don't use DOS as an underlying OS, so DOS commands like COPY and the redirection (>) don't work the same or at all. You are much better off using the VFP COPY command or an API or WSH command.

Rick
 
As Rick suggest I would either use the API CopyFile

Code:
DECLARE INTEGER CopyFile IN kernel32;
	STRING  lpExistingFileName,;
	STRING  lpNewFileName,;
	INTEGER bFailIfExists

? CopyFile ("C:\Autoexec.bat", "C:\Autoexec.cpy", 0)

Or the WSH CopyFile

Code:
#define OverwriteExisting  .t.
loFSO = CreateObject("Scripting.FileSystemObject")
loFSO.CopyFile("C:\scripts\software.txt" , "D:\Archive\", OverwriteExisting )




Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top