Solved

Closing VB after batch file has completed.

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Copy a row 12 62
Sorting multiple rows and columns, and count duplicates in Excel 2013 4 80
Excel Automation VBA 19 71
IF ELSE Statement in Excel Macro VBA 16 65
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

809 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