Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get path for my .exe [duplicate]

Tags:

c#

People also ask

How to get current Exe path in c#?

Get Executable Path With the Assembly Class in C#GetEntryAssembly() function is used to get the assembly of the currently executing code. We can get the path of the currently executing code with the Assembly. GetEntryAssembly(). Location property which returns the executable path of the current in a string variable.

How can call EXE from another EXE in C#?

FileName = "dcm2jpg.exe"; startInfo. WindowStyle = ProcessWindowStyle. Hidden; startInfo. Arguments = "-f j -o \"" + ex1 + "\" -z 1.0 -s y " + ex2; try { // Start the process with the info we specified. // Call WaitForExit and then the using statement will close.

How define file path in C#?

C# Path filename and extensionThe Path. GetFileName returns the file name and extension of a file path represented by a read-only character span. The Path. GetFileNameWithoutExtension returns the file name without the extension of a file path represented by a read-only character span.


System.Reflection.Assembly.GetEntryAssembly().Location;

In addition:

AppDomain.CurrentDomain.BaseDirectory
Assembly.GetEntryAssembly().Location

In a Windows Forms project:

For the full path (filename included): string exePath = Application.ExecutablePath;
For the path only: string appPath = Application.StartupPath;


in visualstudio 2008 you could use this code :

   var _assembly = System.Reflection.Assembly
               .GetExecutingAssembly().GetName().CodeBase;

   var _path = System.IO.Path.GetDirectoryName(_assembly) ;