Solved

Closing VB after batch file has completed.

Posted on 2003-11-26
4
539 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
ID: 9826935
"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
ID: 9827319
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
ID: 9827473
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
ID: 9827966
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

790 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