下面是在PB程序中调用一个BAT批处理文件,然后等待它执行完成。
li_FileNum = FileOpen( "C:/Temp/busy.$$$", LineMode!, Write!, LockWrite!, Replace! )
FileWrite(li_FileNum, "Busy as usual.")
FileClose(li_FileNum)
// Batch file starts successful?
If (Run("run.bat arg1 arg2", Minimized!) = 1) Then
// Yes, batch file started successfully;
// Wait for batch file to finish
Do While (FileExists("C:/Temp/busy.$$$"))
SetPointer(HourGlass!)
Yield()
Loop
End If
The batch file 'run.bat' typically will contain something like:
@echo off
REM --- run.bat --------------
REM function: Do your thing
REM args: - %1: argument 1
REM - %2: argument 2
REM Do your thing here
del C:/Temp/busy.$$$
转载:http://www.pdriver.com/display.asp?key_id=1098