[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

System.Diagnostics.Process interrupt

Posted on 2006-05-06
4
Medium Priority
?
276 Views
Last Modified: 2012-06-21
Hi,

I have this problem:

Dim procusers As New System.Diagnostics.Process()
       procusers.StartInfo.FileName = "C:\test\robocopy.exe"
       procusers.StartInfo.Arguments = """/JOB:C:\test\test1"""
        procusers.Start()
        procusers.WaitForExit(True)
        procusers.Close()
        procusers.Dispose()
        procusers = Nothing

This is running a copy of about 2TB of data and is working well. But, for what ever reason if I stop the program by exiting the dos window it is causing problems on the windows box and the server needs rebooting.

Is there some code I chould use to interrupt this program so it shuts down properly.

I assume that because the app is writing to disk at the time it exits that this is causing the problem.

Thanks
0
Comment
Question by:Donnie4572
  • 3
4 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 2000 total points
ID: 16622283
Hide DOS window by the following way:

procusers.StartInfo.CreateNoWindow = true;
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 16622287
If you want to show user process output, you can redirect it and show in the program window instead of DOS window. See ProcessStartInfo.RedirectStandardOutput Property:

procusers.StartInfo.RedirectStandardOutput = true

0
 
LVL 12

Author Comment

by:Donnie4572
ID: 16622300
Thanks,

Good idea. How does this solve my problem. I need to prgramatically exit the doss window. Example: a button that safely exits procusers.Start.
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 16624230
This prevents user to close DOS window, I understand that this is the problem.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

834 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