Unanswered: Checking if shell-statement is finished
I already have an other question.
I need to copy a file from one location to another.
Now I'm using Shell ("c:\move.bat",vbHide).
move.bat is just a batch-file with a copy-statement.
first question : Is it OK to use DOS or should I do such thing in VB?
If the answer is VB --> how can I do this?
second question : moving the file takes some time.
How can I detect if it is finished.
I was thinking about checking the Windows-process using the variable which I get from the Shell-statement. But how do I write this in VB?
Originally posted by yk58301
It requires very advanced programming to establish that a DOS prompt has finished. (Can tell you how to do it if you need it)
Do it in VB
FileCopy <Source>, <Destination>
If you don't mind I really want to know it.
By the way : I tried copying the file using the FileCopy-statement and I always get a "permission denied-error" .
The file is located on another server, but I got got administrator-rights .
Using my Windows Explorer I have no problems to reach and even modify the file.
Under Win2K, filecopy will fail if the file you are trying to copy is in use by another application.
You have 2 options here:
1) Free file by closing all applications that have it open
2) Write your own copy routing in VBA (using open statement (open as read-only etc...))
As for tracking a DOS process:
You can use windows api functions in VB to iterate through windows.
IF your DOS process window has a unique name (which you can ensure by giving a unique name to the .bat file you are running), you can loop through all windows until you can't find the DOS-process one.
Unfortunately there's no more stable way of doing it, as process tracking in Win95 is different from 97 and different from 2K (2K is similar to NT).
Let me know if you need more info, or go to MSDN (there's an article on process tracking there somewhere)