Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find the folder name and path

Status
Not open for further replies.

swetham

Programmer
May 5, 2010
257
DE
I have created a exe such that when the exe runs, if we right click on any folder name," Run exe" context menu will be coming and in "run exe" there is another exe which should be run. Now in "Run exe" form load i need to get the foldr name and path on which it is clicked.

Can anyone help?
 
Code:
IO.Path.GetDirectoryName(Application.StartupPath)
 
Suppose if my exe is in "c:\Tenp\ex.exe" and if i right on a folder(def) in "E:\abc\def" i need to get the path as "E:\abc\def
 
Are you saying that the other.exe's path is unknown?

Code:
Dim OtherExe As String() = IO.Directory.GetFiles("E:\", "other.exe", IO.SearchOption.AllDirectories)
If OtherExe.Length = 1 Then
     'Found, unique
ElseIf OtherExe.Length = 0 Then
     'Not found
     Exit Sub
Else
     'Found, not unique
End If

For Each theExe aAs String in OtherExe
     MsgBox(IO.Path.GetDirectoryName(theExe))
Next

Hope this helps.

 

"if we right click on any folder name"

Is this happening in Windows Explorer? Could you show some code for how you get the popup to appear?



I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top