Cannot execute EXE from .Net

G

Guest

Here is my code;

Dim psi As New System.Diagnostics.ProcessStartInfo
psi.UseShellExecute = True
psi.FileName = "C:\WinProg.exe"
System.Diagnostics.Process.Start(psi)

Have tested WinProg.exe and works., However, when called from .Net, EXE doesn't execute.

Any help would be appreciated.
 
H

Herfried K. Wagner [MVP]

* "=?Utf-8?B?Sm9obiBGLg==?= said:
Dim psi As New System.Diagnostics.ProcessStartInfo
psi.UseShellExecute = True
psi.FileName = "C:\WinProg.exe"
System.Diagnostics.Process.Start(psi)

Have tested WinProg.exe and works., However, when called from .Net, EXE doesn't execute.

Try 'System.Diagnostics.Process.Start("C:\WinProg.exe")'. If this
doesn't work, try 'Shell(..., ...)'.
 
H

Herfried K. Wagner [MVP]

* "M. Posseth said:
Imports System.Diagnostics

Dim NewProcess as Process = new Process

NewProcess.Start("C:\MyApplication.exe")

No! 'Start' is a /shared/ method of 'Process' that will /return/ a
'Process' object.
 
M

M. Posseth

Imports System.Diagnostics

Dim NewProcess as Process = new Process

NewProcess.Start("C:\MyApplication.exe")

regards

M. posseth [MCP]
 
G

Guest

I tried....

Dim psi As New System.Diagnostics.ProcessStartInfo
psi.UseShellExecute = True
psi.WorkingDirectory = "C:\"
psi.FileName = "WinProg.exe"
System.Diagnostics.Process.Start(psi)
Shell("c:\WinProg.exe", AppWinStyle.Hide, False, -1)

and .........

Dim psi As New System.Diagnostics.ProcessStartInfo
psi.UseShellExecute = True
psi.WorkingDirectory = "C:\"
psi.FileName = "WinProg.exe"
System.Diagnostics.Process.Start("C:\WinProg.exe")

In both cases WinProg.exe did not execute. However, I opened the Windows Task Manager and WinProg.exe was listed in the 'Processes' window with ASPNET as the 'User Name'.
 
G

Guest

I tried....

Dim psi As New System.Diagnostics.ProcessStartInfo
psi.UseShellExecute = True
psi.WorkingDirectory = "C:\"
psi.FileName = "WinProg.exe"
System.Diagnostics.Process.Start(psi)
Shell("c:\WinProg.exe", AppWinStyle.Hide, False, -1)

and......

Dim psi As New System.Diagnostics.ProcessStartInfo
psi.UseShellExecute = True
psi.WorkingDirectory = "C:\"
psi.FileName = "WinProg.exe"
System.Diagnostics.Process.Start("C:\WinProg.exe")

No errors were returned. WinProg.exe failed to execute. However, it was listed as a Process int the Windows Task Manager with ASPNET as the User Name.
 
H

Herfried K. Wagner [MVP]

* =?Utf-8?B?Sm9obiBG?= said:
Dim psi As New System.Diagnostics.ProcessStartInfo
psi.UseShellExecute = True
psi.WorkingDirectory = "C:\"
psi.FileName = "WinProg.exe"
System.Diagnostics.Process.Start(psi)
Shell("c:\WinProg.exe", AppWinStyle.Hide, False, -1)

and......

Dim psi As New System.Diagnostics.ProcessStartInfo
psi.UseShellExecute = True
psi.WorkingDirectory = "C:\"
psi.FileName = "WinProg.exe"
System.Diagnostics.Process.Start("C:\WinProg.exe")

No errors were returned. WinProg.exe failed to execute. However, it was listed as a Process int the Windows Task Manager with ASPNET as the User Name.

Did you call the executable from within an ASP.NET app? Maybe you will
have to use impersonation to call the executable with an other user's
rights.
 
G

Guest

Yes - called the EXE from a .Net app running in Debug mode on same computer. Since the process is started, I seem to need a way to activate it(???)
 
A

Armin Zingler

M. Posseth said:
Dim myproc As System.Diagnostics.Process

myproc = New System.Diagnostics.Process

' Do not receive an event when the process exits.

myproc.EnableRaisingEvents = False

' Start Internet Explorer, passing in a Web page.

myproc.Start("notepad.exe")

End Sub

[...]

No! 'Start' is a /shared/ method of 'Process' that will /return/
a
'Process' object.

So what ??? does this mean i can`t start a external exe from .net
with it ?? cause then i and a few thousand other developers in the
world have a special kind of computer cause on mine it does work
flawless


It works, but you
a) never start the process "myproc"
b) ignore the Process object created by myProc.Start


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
C

Cor Ligthert

Hi M. Posseth,

I hate wrong quoting.
Because as you were letting me feel stupid with your big NO ! to this hole
comunity i think i deserve an explanation

This is not a Big NO it is a normal No, which starts as the first word of a
sentence and has therefore a capital N.

Your message is in my opinion much more agressive than the one from
Herfried.

When you normal ask something as "Why? are you writing this", than I am sure
that he will sure give your an explanation, for which I am as well very
curious as you.

I have never seen Herfried saying he is perfect.

Cor
 
M

M. Posseth

HUH ???? !!!

question was : Cannot execute .exe from .NET

So what is wrong with my answer ???

Please explain ?

Because as you were letting me feel stupid with your big NO ! to this hole
comunity i think i deserve an explanation
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click


Dim myproc As System.Diagnostics.Process

myproc = New System.Diagnostics.Process

' Do not receive an event when the process exits.

myproc.EnableRaisingEvents = False

' Start Internet Explorer, passing in a Web page.

myproc.Start("notepad.exe")

End Sub

i would not now anny reasson why this code wouldn`t be valid

As this code is in the field known as the replacement for the shellexecute
API
as this code was recomended as a replacement for the shellexecute api by
ALLAPI.net
as this code appears in MSDN as a valid code to execute external programs or
asociations ( like a web adres or mailto command )

' Start Internet Explorer, passing in a Web page.
myproc.Start("IExplore.exe", http://www.microsoft.com)

your answer

No! 'Start' is a /shared/ method of 'Process' that will /return/ a
'Process' object.

So what ??? does this mean i can`t start a external exe from .net with it ??
cause then i and a few thousand other developers in the world have a special
kind of computer cause on mine it does work flawless
 
G

Guest

Hi,
I've experience the same problem. This happens when I tried to make it works with web application. I'm using VS .net 2003. Suprisingly, When I use Windows application, everything works fine. Anyone can explain why this happens?


Noor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top