Author | Topic: Copy command | |
---|---|---|
Frankie | Copy command on Mon, 21 Mar 2005 22:37:02 +0800 Hi all, I have a runshell function that use dos "copy" command to add some string from a txt file to a binary file and it has been working for years (ploted from clipper). Recently i try to change to longfilename path but fail. Can anyone enlighten me? Here is the function. cDllFile := "D:\CustApp\Info.dll" cTempFile := "C:\Temp\Info.txt" Info.txt has a string - "123" RUNSHELL("/C COPY /b &cDllFile. + &cTempFile &cExeFile. > NUL",,,.T.) The string '123" can be sucessfully added to the end of Info.dll. However, if cDllFile := "D:\Customer App\Info.dl", it doesn't work. I know i can use short-path but the path was generated from where the app started. TIA Frankie Yap | |
Phil Ide | Re: Copy command on Mon, 21 Mar 2005 14:54:28 +0000 Frankie, > I have a runshell function that use dos "copy" command to add some > string from a txt file to a binary file and it has been working for > years (ploted from clipper). Recently i try to change to longfilename > path but fail. > > Can anyone enlighten me? > > Here is the function. > > cDllFile := "D:\CustApp\Info.dll" > cTempFile := "C:\Temp\Info.txt" Info.txt has a string - "123" > RUNSHELL("/C COPY /b &cDllFile. + &cTempFile &cExeFile. > NUL",,,.T.) > > The string '123" can be sucessfully added to the end of Info.dll. > > However, if cDllFile := "D:\Customer App\Info.dl", it doesn't work. You have to see what you are doing. Here's the command line you produce: /C COPY /b D:\Customer App\Info.dl + C:\Temp\Info.txt > NUL If you break the copy command down you have this: COPY [/opt] [param1] [param2] + [param3] > NUL What you wanted was this: COPY [/opt] [param1] + [param2] > NUL If you put quotes around cDllFile, it will work: cDllFile := '"D:\CustApp\Info.dll"' Regards, Phil Ide *************************************** * Xbase++ FAQ, Libraries and Sources: * * goto: http://www.idep.org.uk/xbase * *************************************** Cranial Input Error: Line Status Register 02 | |
Thomas Braun | Re: Copy command on Mon, 21 Mar 2005 16:33:57 +0100 Frankie wrote: > years (ploted from clipper). Recently i try to change to longfilename > path but fail. > > Can anyone enlighten me? Long file names have to be surrounded by " > cDllFile := "D:\CustApp\Info.dll" > cTempFile := "C:\Temp\Info.txt" Info.txt has a string - "123" > RUNSHELL("/C COPY /b &cDllFile. + &cTempFile &cExeFile. > NUL",,,.T.) Something like this should do the trick (I would use temporary variables to contruct the runshell string to make code a bit more readable): RUNSHELL( '/C COPY /B "&cDLLFile." + "&cTempFile" "&cExeFile." > NUL',,,.T.) HTH Thomas Braun | |
Frankie | Re: Copy command on Tue, 22 Mar 2005 02:19:02 +0800 Thanks Phil and Thomas, I have managed to use Thomas's solution and it works. Regards Frankie Yap |