// The following returns the application executable path with exe name
Console.WriteLine(System.Environment.CommandLine);
// or
Console.WriteLine(System.Windows.Forms.Application.ExecutablePath);
// or
Console.WriteLine(System.Reflection.Assembly.GetExecutingAssembly().Location);
// The following returns just the application executable path
Console.WriteLine(System.Environment.CurrentDirectory);
// or
Console.WriteLine(System.IO.Directory.GetCurrentDirectory());
// or
Console.WriteLine(System.Windows.Forms.Application.StartupPath);
// or
Console.WriteLine(System.AppDomain.CurrentDomain.BaseDirectory);
// or
Console.WriteLine(System.Reflection.Assembly.GetExecutingAssembly().CodeBase);
Monday, January 22, 2007
Many ways to get your application path
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment