How to get the full winform path?

I have winform, and its full path is C: \ test.exe

How do I get the full winform path at runtime? For example, a user may move winform to other places. Thanks.

+4
source share
5 answers

Since you use WinForms, there are two simple properties in the Application class:

+2
source

This will give you the file name: System.Reflection.Assembly.GetExecutingAssembly (). ManifestModule.Name

For the folder name, try: System.Reflection.Assembly.GetExecutingAssembly (). Location (not sure ... on my head)

0
source

You can call Assembly.GetEntryAssembly () .CodeBase (or location) from a Windows-Form application (but not from ASP.NET applications).

0
source

This information is part of the My namespace. The directory path can be found through My.Application.Info.DirectoryPath

0
source

You can also use

Environment.CurrentDirectory It will provide you with the full path to the working directory.

0
source

All Articles