473,387 Members | 1,495 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

VB.net exec command line program

I am writing an application that will call a command line
application. Basically I have set up the windows 2003
POP3/SMTP service and to change a password of a mailbox,
I need to execute the following program:

winpop changepwd so******@domain.com SomePassword

I have the folowing code in a .NET app so that I can
change the password using a GUI:

Try
Dim p As New Process

With p.StartInfo
.UseShellExecute = True
.FileName = "winpop.exe"
.Arguments = "changepwd " &
txtUsername.Text & " " & txtPassword.Text
End With

' Execute the process and wait for it to
exit
If p.Start() Then
p.WaitForExit()
End If
Catch ex As Exception
MsgBox(ex.Message,
MsgBoxStyle.Critical, "System Notification")
End Try

If lets say that a user could not be found, the command
line program will tell me about it as seen here: A
problem occured. The password for this mailbox could not
be changed.
The specified domain either does not exist or could not
be contacted.

Is there a way that I can get these messages to appear in
my VB.net app so that I know when an error occurs? Try
Catch will not grab these.
Jul 21 '05 #1
1 9571

"Nicholas Then" <Ni**@unitedagy.com> wrote in message
news:00****************************@phx.gbl...
I am writing an application that will call a command line
application. Basically I have set up the windows 2003
POP3/SMTP service and to change a password of a mailbox,
I need to execute the following program:

winpop changepwd so******@domain.com SomePassword

I have the folowing code in a .NET app so that I can
change the password using a GUI:

Try
Dim p As New Process

With p.StartInfo
.UseShellExecute = True
.FileName = "winpop.exe"
.Arguments = "changepwd " &
txtUsername.Text & " " & txtPassword.Text
'redirect the standard ouput to your app

.RedirectStandardOutput=true
End With

' Execute the process and wait for it to
exit
If p.Start() Then
p.WaitForExit()
'now get the result

Dim str as string
str = p.StandardOutput.ReadToEnd();
End If
Catch ex As Exception
MsgBox(ex.Message,
MsgBoxStyle.Critical, "System Notification")
End Try

If lets say that a user could not be found, the command
line program will tell me about it as seen here: A
problem occured. The password for this mailbox could not
be changed.
The specified domain either does not exist or could not
be contacted.

Is there a way that I can get these messages to appear in
my VB.net app so that I know when an error occurs? Try
Catch will not grab these.

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Falk Schneider | last post by:
I wrote a PHP shell script under Linux which puts all existing PS-Files within a directory into a list and should then start a single Ghostview window for each file. Sounds simple, but it's not: ...
1
by: Noah | last post by:
Is there a way to get PHP to define LD_LIBRARY_PATH when using exec to start an external program? I wrote an xml validation utility in C++ that links to the Xerces C library. I linked with the...
4
by: Andrew Crowe | last post by:
Hi guys, I'm having trouble executing commands using exec() or system() that need to write files. I've set the permissions on CMD.EXE but I can't use exec() to write any files, even if the...
17
by: Piotr Wolski | last post by:
can anyone help me: using exec() function in PHP i can execute linux programms like ls,who and other, however i can not execute C programms and i really don't know why. Please help me, Peter
6
by: Hal Vaughan | last post by:
I have a script used to find and run Java on a Windows system.  It worked fine on original tests (on a Windows XP system).  It's now running on a Windows 2000 (sp3) system, and it won't work -- the...
5
by: JW | last post by:
Hi, I don't seem to get any results from the following use of Runtime.getRuntime().exec(cmd) using Java 1.4 on Redhat linux. Suppose that in the same directory as my java file below, I have...
0
by: Jan | last post by:
I store sql-commands in a database table. In the first step I get the sql command out of the database table with embedded sql. In the second step I try to execute the command, which i got from the...
5
by: snicks | last post by:
I'm trying to exec a program external to my ASP.NET app using the following code. The external app is a VB.NET application. Dim sPPTOut As String sPPTOut = MDEPDirStr + sID + ".ppt" Dim p As...
4
by: vol30w60 | last post by:
Hi folks, I am trying to launch a program with PHP code. I am running Apache on Windows XP SP2. I am using the method noted here: http://us2.php.net/manual/en/function.exec.php#59428 To...
26
by: warth33 | last post by:
Hello I have a php site. Some page needs to call an external program. The programs are home made c# applications. It uses to work without problem. For a while. Maybe it work for some hour....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.