Solved

retrieve messages from batch files

Posted on 2013-12-17
7
349 Views
Last Modified: 2013-12-19
I'm using vb 2008 with asp.net 3.5.  The program writes a batch file on the server using a streamwrite like this.  It then runs the batch file using a shell command as per the last line.
There are two errors I want to trap.
The ID and password are incorrect.
The file was not present on the server being accessed by the batch file.

If an error happens I want to display a meaningful message in Internet Explorer.  How do I do this?
The batch file is attached (with hostname, ID and password changed).
Attachment.txt
0
Comment
Question by:AlHal2
  • 3
  • 3
7 Comments
 
LVL 35

Expert Comment

by:Miguel Oz
ID: 39725595
Please post the code that runs your batch file. I need to see what you are using.
Basically you need to capture the screen output and display it in a label in your page. Is this OK for you?
0
 

Author Comment

by:AlHal2
ID: 39726254
Please let me know what you need beyond what's in the attachment.
0
 
LVL 35

Expert Comment

by:Miguel Oz
ID: 39726316
I need:
1) The code that runs the batch file you save in the attachment
2) Answer to my question above.
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:AlHal2
ID: 39726356
The code in the attachment is generated when the user presses a button.
I would like to capture the screen output and display it as a label in the page.
Hope this clarifies things.
0
 
LVL 35

Accepted Solution

by:
Miguel Oz earned 250 total points
ID: 39727887
The attached code only shows how to generate the batch file, not how the file is executed.
Any way, you can use Process StartInfo.RedirectStandardOutput property  = true to run your batch file as shown in the link below:
http://www.dotnetperls.com/redirectstandardoutput
0
 

Author Closing Comment

by:AlHal2
ID: 39728738
Thanks.  I used the shell command at the bottom of the attachment to execute the batch file, but I think your method is better.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

813 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

16 Experts available now in Live!

Get 1:1 Help Now