Home
Manage Your Code
Snippet: Path to EXE (C#)
Title: Path to EXE Language: C#
Description: Get the path to the executable file in a windows service Views: 136
Author: Paul Ward Date Added: 7/18/2008
Copy Code  
1using System.Reflection;
2
3private string _exePath;
4
5        public string ExePath
6        {
7            get
8            {
9                _exePath = Assembly.GetEntryAssembly().Location;
10                if (_exePath != "")
11                    _exePath = _exePath.Substring(0, _exePath.LastIndexOf("\\") + 1);
12
13                return _exePath;
14            }
15        }