Solved

Closing VB after batch file has completed.

Posted on 2003-11-26
4
525 Views
Last Modified: 2010-05-01
I have a VB program which launches a DOS (Shell) batch file in Windows XP. The batch file simply copies the user desktop to a server. The user receives a message box advising when this has process has started. The batch file runs perfectly and closes itself down as intended.

How do I get the VB program to display a message telling the user the backup is complete once the batch file has closed. A code example would be greatly appreciated and I really need this urgently, hence the high points.

Thank you.
0
Comment
Question by:comsult
  • 2
4 Comments
 
LVL 28

Expert Comment

by:AzraSound
Comment Utility
"Determining the End of a Shelled Application Using WaitForSingleObject"
http://www.mvps.org/vbnet/index.html?http://www.mvps.org/vbnet/faq/main/waitforsingleobject2.htm
0
 
LVL 2

Accepted Solution

by:
robbrownuk earned 500 total points
Comment Utility
Why do you need a batch file??


Can you not use the filecopy function in Visual basic?

'show the window here - let user know backup is in progress
FileCopy "C:\Documents and Settings\USERNAME\Desktop", "\\server\share\"
'show the 2nd window here - let user know backup is complete
End


Hope this helps,

robbrownuk
0
 

Author Comment

by:comsult
Comment Utility
I was using a batch file as we had a different folder location for each day of the week, in effect seven batch files controlled by If statements.

FileCopy is such a simple and excellent idea. I have tried using it to copy my Desktop folder to my server but I get a Run-time error 75, path/file access error. I have checked the help but don't have any of the problems they suggest. Sorry I'm still quite new to VB, what am I missing ?

Thanks also to AzraSound, I have had a look at this solution but would like to go with FileCopy if I can get past the error.
0
 

Author Comment

by:comsult
Comment Utility
Ignore my previous post, I realise now that FileCopy in its basic state can only handle one file at a time. I have expanded it to include directories and now have exactly what I need.

Thank you very much for the help.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now