469,572 Members | 1,198 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,572 developers. It's quick & easy.

Cannot execute EXE from .Net

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.

Nov 20 '05 #1
12 1761
* "=?Utf-8?B?Sm9obiBGLg==?=" <John F.@discussions.microsoft.com> scripsit:
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(..., ...)'.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2
Imports System.Diagnostics

Dim NewProcess as Process = new Process

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

regards

M. posseth [MCP]

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:2j*************@uni-berlin.de...
* "=?Utf-8?B?Sm9obiBGLg==?=" <John F.@discussions.microsoft.com> scripsit:
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(..., ...)'.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #3
* "M. Posseth" <mi*****@nohausystems.nl> scripsit:
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.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #4
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'.

"Herfried K. Wagner [MVP]" wrote:
* "=?Utf-8?B?Sm9obiBGLg==?=" <John F.@discussions.microsoft.com> scripsit:
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(..., ...)'.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #5


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.
"Herfried K. Wagner [MVP]" wrote:
* "=?Utf-8?B?Sm9obiBGLg==?=" <John F.@discussions.microsoft.com> scripsit:
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(..., ...)'.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #6
* =?Utf-8?B?Sm9obiBG?= <Jo***@discussions.microsoft.com> scripsit:
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.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #7
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(???)

"Herfried K. Wagner [MVP]" wrote:
* =?Utf-8?B?Sm9obiBG?= <Jo***@discussions.microsoft.com> scripsit:
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.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #8
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
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:2j*************@uni-berlin.de... * "M. Posseth" <mi*****@nohausystems.nl> scripsit:
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.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #9
"M. Posseth" <mi*****@nohausystems.nl> schrieb
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

Nov 20 '05 #10
Hi M. Posseth,

I hate wrong quoting.
No! 'Start' is a /shared/ method of 'Process' that will /return/ a
'Process' object.
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
Nov 20 '05 #11
* "M. Posseth" <mi*****@nohausystems.nl> scripsit:
HUH ???? !!!

question was : Cannot execute .exe from .NET

So what is wrong with my answer ???


See:

<URL:http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemdiagnosticsprocessclassstarttopic3.asp>

'Start' is a shared property of the 'Process' class, so instantiating
doesn't make sense.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #12
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

"John F" wrote:
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(???)

"Herfried K. Wagner [MVP]" wrote:
* =?Utf-8?B?Sm9obiBG?= <Jo***@discussions.microsoft.com> scripsit:
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.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #13

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Ken Allen | last post: by
4 posts views Thread by Chris | last post: by
3 posts views Thread by Peter Afonin | last post: by
4 posts views Thread by Michael C | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.