PC Review


Reply
Thread Tools Rate Thread

Determining Path To A Separate Program

 
 
Phil Galey
Guest
Posts: n/a
 
      27th Oct 2004
In VB.NET, when you use shell or have a process object point to and run a
separate application that is installed on the machine, is there a way of
determining the path to the executable? I've been having the user point to
it using the Open File Dialog from an Options menu item, but the program
should be able to determine the path to a named program without relying on
user intervention.

Thanks.


 
Reply With Quote
 
 
 
 
Scott Swigart
Guest
Posts: n/a
 
      27th Oct 2004
Don't know if this is the best way, but you can just loop through the paths
in the PATH environment variable and look for the file in each one. Here's
a console app that does it:

Imports System.Environment
Imports System.IO

Module Module1

Sub Main()
Dim fileToFind As String = "Notepad.exe"
For Each pathName As String In
GetEnvironmentVariable("path").Split(";")
Dim fullPath As String = pathName & "\" & fileToFind
If File.Exists(fullPath) Then
Console.WriteLine(fullPath)
End If
Next

End Sub

End Module

- Scott Swigart


"Phil Galey" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> In VB.NET, when you use shell or have a process object point to and run a
> separate application that is installed on the machine, is there a way of
> determining the path to the executable? I've been having the user point
> to
> it using the Open File Dialog from an Options menu item, but the program
> should be able to determine the path to a named program without relying on
> user intervention.
>
> Thanks.
>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
determining which record is active in a separate form apedersen@gmail.com Microsoft Access Forms 2 28th Jan 2006 02:08 PM
Determining the path to the .NET framework andreas.baus@meta-level.de Microsoft Dot NET Framework 3 12th Aug 2005 05:36 PM
Determining if a path is a network path (aka mapped drive - PathIsNetworkPath) Robert Munroe Microsoft C# .NET 0 10th Dec 2003 10:35 PM
determining correct ARC path? Tim Stephens Microsoft Windows 2000 Setup 0 5th Sep 2003 11:36 PM
Determining Desktop Path Roger Microsoft VB .NET 2 2nd Sep 2003 08:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:56 AM.