Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

retrieve messages from batch files

Posted on 2013-12-17
7
Medium Priority
?
387 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 36

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 36

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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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 36

Accepted Solution

by:
Miguel Oz earned 1000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
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.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

722 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