Solved

Closing VB after batch file has completed.

Posted on 2003-11-26
4
528 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

911 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

23 Experts available now in Live!

Get 1:1 Help Now