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


System.Diagnostics.Process interrupt

Posted on 2006-05-06
Medium Priority
Last Modified: 2012-06-21

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 = 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.

Question by:Donnie4572
  • 3
LVL 48

Accepted Solution

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

procusers.StartInfo.CreateNoWindow = true;
LVL 48

Expert Comment

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

LVL 12

Author Comment

ID: 16622300

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

Expert Comment

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

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