473,785 Members | 3,388 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
.UseShellExecut e = True
.FileName = "winpop.exe "
.Arguments = "changepwd " &
txtUsername.Tex t & " " & txtPassword.Tex t
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.Messa ge,
MsgBoxStyle.Cri tical, "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 9589

"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
.UseShellExecut e = True
.FileName = "winpop.exe "
.Arguments = "changepwd " &
txtUsername.Tex t & " " & txtPassword.Tex t
'redirect the standard ouput to your app

.RedirectStanda rdOutput=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.StandardOutpu t.ReadToEnd();
End If
Catch ex As Exception
MsgBox(ex.Messa ge,
MsgBoxStyle.Cri tical, "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
10921
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: The following code provides for about half of the functionality I wanted: ==============code starts $bla = array(); foreach ($filelist as $file)
1
4055
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 -rpath option, so that I should not have to manually set the LD_LIBRARY_PATH to find the Xerces shared object. This works fine from the command line. I can run my tool and it finds the library without having LD_LIBRARY_PATH set. (If -rpath is not...
4
3090
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 folder I'm writing to has write access to IUSER account and PHP can write to the folder directly. eg. Calling exec('echo hello >C:\writablefolder\text.txt') does nothing,
17
2412
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
8386
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 problem is this line: set oCommand = WshShl.Exec(sCommand) (it's about halfway down)  Is there a problem with the Exec method in some versions of VBS?  Is the problem Windows version I'm on, or is it something more obvious that I'm just not...
5
40502
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 files junk1, junk2, junk3, and i want to have the java program delete all of these files.
0
10213
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 database table, using dynamic sql. Executing 'EXEC SQL DESCRIBE SELECT LIST FOR S INTO select_dp;' the error code -2149 is returned That means "Specified partition does not exist". Does anybody know if it is a database problem or a problem of
5
3647
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 New System.Diagnostics.Process 'p.Start(MDEPDirStr & "macrun.exe", sPPTOut) p.Start("C:\WINDOWS\SYSTEM32\CALC.EXE") 'p.Start("C:\WINDOWS\SYSTEM32\macrun.exe", sPPTOut)
4
22881
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 simplify things, I am trying to launch notepad with the following line of code:
26
3664
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. Or for a day. Or even for a week. At a certain point, when a php script calls the exe file, the application freezes. The following happens:
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10319
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10087
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9947
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7496
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4046
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.