Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Run Command not working for Xcopy under NT
Message
De
22/03/2001 05:07:24
 
 
À
22/03/2001 04:23:30
Information générale
Forum:
Visual FoxPro
Catégorie:
FoxPro 2.x
Divers
Thread ID:
00486484
Message ID:
00487540
Vues:
8
Hello Ed

No thats not the case. I started off by using the function exactly as per your example.

On my workstation it merely flashes up the Bad Command in the DOS window then terminates.

This may remain a mystery however the function below seems to
work in all circumstances so problem solved.

Thanks for your help.


>
>The reason it doesn't work is your insistance on using the /N parameter with RUN; take it out and it works. RUN will use FOXRUN.PIF automatically.
>
>>
>>Here is the code
>>
>>
>>
>>FUNC DOSRun
>>PARAMETER lcCommand
>>lcTmpFile=SYS(2023)+'\'+SYS(3)+'.BAT'
>>lcFinFile=strtran(lcTmpFile,'.BAT','.FIN')
>>nFH = FCREATE(lcTmpFile)
>>=FPUTS(nFH, lcCommand)
>>=FPUTS(nFH,'ECHO FINISHED >> '+lcFinFile)
>>=FPUTS(nFH,'EXIT')
>>=FCLOSE(nFH)
>>IF FILE(lcTmpFile)
>>	lcExecute='RUN /N FOXRUN.PIF /C '+lcTmpFile
>>	&lcExecute
>>	llretval=.t.
>>ELSE
>>  WAIT WINDOW 'Unable to create batch file'
>>  llretval=.f.
>>endif
>>llmore=.t.
>>do while !file(lcFinFile) && scan loop to check for existence of the finish file '????????.FIN'
>>   wait window 'DOS Command Executing ' timeout 1	
>>enddo
>>ERASE (lcTmpFile)
>>ERASE (lcFinFile)
>>wait window 'Finished Command' nowait
>>return llretval
>>
>>
>>
>>
>>
>>>>I am having trouble getting the run command to work properly for Foxpro 2.6 running under NT.
>>>>
>>>>Originally I was having a problem with the error
>>>>
>>>>RUN/! COMMAND FAILED
>>>>
>>>>The following function appeared to fix this problem for most commands however I am still a bit unsure why.
>>>>
>>>>func dosrun
>>>>param lcDosCom
>>>>lcCom='RUN /N FOXRUN.PIF /C '+lcdosCom
>>>>&lcCom
>>>>return
>>>>
>>>>The fix does not seem to work for commands that take longer to execute however.
>>>>
>>>>For those commands the DOS window flashes up but nothing happens.
>>>>
>>>>I cannot use Ed's utility API_APPRUN because its a VCX though I suppose perhaps if I looked at it I could strip the relevant bits out.
>>>>
>>>>Has anyone already solved this problem:)
>>>
>>>Under FPW, your best bet would be to try to use WinExec() via the FOXTOOLS RegFn() and CallFn() mechanism - CreateProcess() is Win32-specific, and there's no DECLARE...DLL; the FoxTools RegFn() and CallFn()constructs are the most direct way to access the API in FPW. There's no wait potential, though in WinExec(); you'd have to watch for a Window or something to detect termination.
>>>
>>>Another approach is to create a .BAT file that you run - you can use the START verb in the .BAT file with the /WAIT parameter, and issue the RUN without the /N - you'd have to modify FOXRUN.PIF to run minimized and close on exit. Your function would look something like:
>>>
>>>FUNC DOSRun
>>>PARAMETER lcCommand
>>>nFH = FCREATE('MyTemp.BAT')
>>>=FPUTS(nFH,'START /WAIT /MIN ' + lcCommand) && wait on completion, minimized
>>>=FPUTS(nFH,'EXIT')
>>>=FCLOSE(nFH)
>>>RUN MyTemp.BAT
>>>ERASE MyTemp.BAT
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform