Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / October 2007

Tip: Looking for answers? Try searching our database.

How to run process from root folder

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kimiraikkonen - 01 Oct 2007 21:21 GMT
Hello,
I want my external app run without specifying a certain path. It's
enough to be in the same folder with my vb.net exe.

System.Diagnostics.Process.Start("c:\3rdpartyapp.exe") is not OK for
me because everyuser should put it into c:\

i tried:

System.Diagnostics.Process.Start("3rdpartyapp.exe") with no success.
How can i specify root folder?
Herfried K. Wagner [MVP] - 01 Oct 2007 21:34 GMT
"kimiraikkonen" <kimiraikkonen85@gmail.com> schrieb:
> I want my external app run without specifying a certain path. It's
> enough to be in the same folder with my vb.net exe.

\\\
Imports System.Diagnostics
Imports System.IO
...
Dim ExecutablePath As String
ExecutablePath = Path.Combine(Application.StartupPath, "foo.exe")
Process.Run(ExecutablePath)
///

Signature

M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>

kimiraikkonen - 02 Oct 2007 10:31 GMT
On Oct 1, 11:34 pm, "Herfried K. Wagner [MVP]" <hirf-spam-me-
h...@gmx.at> wrote:
> "kimiraikkonen" <kimiraikkone...@gmail.com> schrieb:
>
[quoted text clipped - 14 lines]
> M V P  <URL:http://dotnet.mvps.org/>
>  V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>

Is there a shorter way?
rowe_newsgroups - 02 Oct 2007 11:30 GMT
> On Oct 1, 11:34 pm, "Herfried K. Wagner [MVP]" <hirf-spam-me-
>
[quoted text clipped - 19 lines]
>
> Is there a shorter way?

Shorter way? Why the heck does that matter?

Anyways, you could do it in one giant, sloppy (imo), line:

Process.Run(Path.Combine(Application.StartupPath, "foo.exe"))

However, in my opinion being verbose is much better than trying to
make a "short" program. When you go to in to perform maintenance on
your code it is much more difficult to work with compact code.

Thanks,

Seth Rowe
kimiraikkonen - 03 Oct 2007 10:57 GMT
> > On Oct 1, 11:34 pm, "Herfried K. Wagner [MVP]" <hirf-spam-me-
>
[quoted text clipped - 35 lines]
>
> - Show quoted text -

Seth,
I understood and i agree that i don't like short coding but i want a
well-organized and well-understandable codings. That's why i asked the
shorter way meaning if there are alternative coding methods for
specifying root folder.

However look at this, there 2 problems:

1-I cannot hide my "foo.exe" while it's processing until it finishes,
it still present on the screen,
2-Between which lines should i put appstartup path for running
everyfolder where my project is installed?

           Dim myProcess As System.Diagnostics.Process = New
System.Diagnostics.Process()
           myProcess.StartInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Hidden
            myProcess = System.Diagnostics.Process.Start("c:
\foo.exe")
           myProcess.WaitForExit()
           MsgBox(" Completed Successfully", MsgBoxStyle.Information,
"Completed")
Patrice - 02 Oct 2007 12:51 GMT
You could create a sub or function  that take the exe file as an argument if
you need to use this several times for different exe files (read the
language specification at least once if needed)...

---
Patrice

> On Oct 1, 11:34 pm, "Herfried K. Wagner [MVP]" <hirf-spam-me-
> h...@gmx.at> wrote:
[quoted text clipped - 18 lines]
>
> Is there a shorter way?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.