>The folowing BATCH file works OK in WIN98 but does not work in WINXP.
>
>************
>: backup.bat
>: dele files on floppy
>echo Y|del a:\*.*
>
>: zip data and sys files
>pkzip.exe -& a:\tp.zip *.dbf *.fpt *.cdx *.sys
>
>**************
>Batch file, pkzip.exe and data files all reside in same directory.
>
>The first command (delete the files) runs OK.
>
>The second command fails after PKZIP (fails to run the parameters) and shows the PKZIP help screen.
>
>I found that I have to put in a delay of 30 seconds (permit pkzip to build the ZIP file on the floppy) to prevent VFP from executing the next commands after I execute the 'RUN /N backup.bat'. This enabled the batch file to RUN OK in WIN95 and 98 but it fails in WINXP. WIthout the delay, my command to reopen the tables is executed before the ZIP process completes and some tables/indexes/memo files are not zipped.
The problem arises because, by default, under WinNT/2K/XP the RUN command runs CMD.EXE for batch and .CMD files, rather than COMMAND.COM which you get in Win9x. In the CMD.EXE command processor, the "&" symbol separates multiple commands on the command line, so everything following it is being treated as a separate command.
According to Windows 2000 help, if you put an escape character (CHR(27), shows as "^" in a command window) before the "&" it allows typing command symbols as text, so you could try
pkzip.exe -^& a:\tp.zip *.dbf *.fpt *.cdx *.sys
This approach would mean slightly different batch files for the Win9x and NT/2K/XP platforms. XP-specific command reference:
http://www.microsoft.com/windowsxp/home/using/productdoc/en/default.asp?url=/WINDOWSXP/home/using/productdoc/en/ntcmds_shelloverview.aspAnother option: if the COMMAND processor is available on WinXP (don't know, it is available on 2K) you could call your batch file as follows:
RUN /N COMMAND /C backup.bat
As for your VFP program continuing before PKZip has finished, you need a process that will call your batch file then wait for it to complete before your VFP program resumes. Instead of RUN, Ed Rauh's API_AppRun class can do this:
API_APPRUN in .VCX form File #
9477Although I haven't used it, I believe the ShellExecute function can do this too - search messages here to find examples.
Finally, if you have a budget for this, consider using the DynaZip product instead of PKZip for DOS. A number of people here have used it, and since it's redistributable it avoids the requirement for your users to license PKZip for DOS.
http://www.innermedia.com/Products/Zip-compression/zip-compression.htmDynaZip Class File #
9895DynaZip AX Wrapper files (not classes) File #
10038
Regards. Al
"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov
Neither a despot, nor a doormat, be
Every app wants to be a database app when it grows up