Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two project folders. I demonstrate my folders:

A Project_Folder
- bin
-- Debug (default folder if I use a path like : @"FileName"
B Project_Folder
- bin
-- Debug
--- RAF.exe

So from the default folder (A Project_Folder) I would like to choose the RAF.exe file from the B section.

What I have tried:

System.Diagnostics.Process.Start(@"\RAF\bin\Debug\RAF.exe..\..\..\..\");
Posted
Updated 3-Sep-18 20:09pm
v2

1 solution

For starters, don't do it like that.
To go up, it would have to proceed the exe file name:
\RAF\bin\Debug\..\..\..\..\RAF.exe
And since an initial backslash means "from the root directory" you can't go up that many levels anyway.
But ... as I said, don't do that. The reason I say that is simple: in production the folder layout will not be the same, or even close. Once installed, you app will be under Program Files - which isn't necessarily under the root directory of any disk - and the app name. The Debug folder will almost certainly not be available, or probably the bin folder. Instead of "hard wiring" the location and assuming a folder structure that
is unlikely to exist, use a configuration file to store the absolute path to your target EXE and set that when your program first installs.
 
Share this answer
 
Comments
Galarist_00 4-Sep-18 8:10am    
I tried yours, but not worked. Then I modified it to this: @"..\..\..\RAF\bin\Debug\RAF.exe" and it works as I want, thanks :)
OriginalGriff 4-Sep-18 9:15am    
I was guessing based on the info you gave us - which doesn't include the folder structure you are using! :laugh:

It's still a bad idea to hardwire it - it will be different in production.
Galarist_00 4-Sep-18 13:16pm    
Sorry for not making it more clearly. At least I figured out. Also, thanks for your help.
OriginalGriff 4-Sep-18 14:03pm    
You're welcome!

(And don't worry about it - we get a whole load less information sometimes. I think my favorite is "it doesn't work" without telling us what it's supposed to do, what it does, or even showing us the code. We get that pretty much every day. :sigh: )

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900