![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Difference in getting the current exe directory AppDomain.BaseDirectory Gets the base directory that the assembly resolver uses to probe for assemblies and it is similar to AppDomainSetup.ApplicationBase. Environment.CurrentDirectory Gets or sets the fully qualified path of the current working directory. Directory.GetCurrentDirectory() Gets the current working directory of the application. Obviusly it is an read only method. Assembly.GetExecutingAssembly().Location Gets the path or UNC location of the loaded file that contains the manifest. "Kakkanattu" <robinmathewk@xxxxxx> wrote in message news:1f48008e-db9d-40ef-a7cb-4acf6f375ee9@xxxxxx Quote: > Hi, > In desktop application, we use different ways to get the current > execution directory. > I. AppDomain.CurrentDomain.BaseDirectory > II. Environment.CurrentDirectory > III. Directory.GetCurrentDirectory() > IV. Assembly.GetExecutingAssembly().Location > > Can u please help me to know the difference of all these? Also is > there any other way to get the current directory other than the above? > > Thanks in advance > Robin Mathew |
My System Specs![]() |
| | #2 (permalink) |
| | RE: Difference in getting the current exe directory More often than not, only 2 and 3, which are equivalent, will get the current directory. 1 "Gets the base directory that the assembly resolver uses to probe for assemblies.", per MSDN. 4 gets the location of the assembly that is executing. When a shortcut to an executable is used, the current directory may be different than the executable location. I suspect there are many other ways to get the current location. "Kakkanattu" wrote: Quote: > Hi, > In desktop application, we use different ways to get the current > execution directory. > I. AppDomain.CurrentDomain.BaseDirectory > II. Environment.CurrentDirectory > III. Directory.GetCurrentDirectory() > IV. Assembly.GetExecutingAssembly().Location > > Can u please help me to know the difference of all these? Also is > there any other way to get the current directory other than the above? > > Thanks in advance > Robin Mathew > |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Difference in getting the current exe directory AppDomain.BaseDirectory Gets the base directory that the assembly resolver uses to probe for assemblies and it is similar to AppDomainSetup.ApplicationBase. Environment.CurrentDirectory Gets or sets the fully qualified path of the current working directory. Directory.GetCurrentDirectory() Gets the current working directory of the application. Obviusly it is an read only method. Assembly.GetExecutingAssembly().Location Gets the path or UNC location of the loaded file that contains the manifest. "Kakkanattu" <robinmathewk@xxxxxx> wrote in message news:1f48008e-db9d-40ef-a7cb-4acf6f375ee9@xxxxxx Quote: > Hi, > In desktop application, we use different ways to get the current > execution directory. > I. AppDomain.CurrentDomain.BaseDirectory > II. Environment.CurrentDirectory > III. Directory.GetCurrentDirectory() > IV. Assembly.GetExecutingAssembly().Location > > Can u please help me to know the difference of all these? Also is > there any other way to get the current directory other than the above? > > Thanks in advance > Robin Mathew |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| How can I Write-Host the current directory? | PowerShell | |||
| bug in join-path when the current directory is used | PowerShell | |||
| how do I keep powershells current directory and dotnets current directory in sync | PowerShell | |||
| Executing scripts in the current directory | PowerShell | |||
| Manipulating current directory as a variable | PowerShell | |||