# Executable File Path
There have been a question recently at our forum about how to get the full path of the current executable file.
First idea proposed was to use argv argument from main function, but this solution is wrong. The proof is a simple example with my program called Parametrizer. As this screenshot shows, program run from the command line with current directory equal to the directory where the executable file lies results in the argv being set to only file name, without the full path.
The correct solution for Windows is to use GetModuleFileName function, just like this:
char exePath[MAX_PATH]; GetModuleFileName(NULL, exePath, _countof(exePath));
Then you can extract only the directory path and append any other file name to be sure you always access files installed with your application from the correct directory refered by the full, absolute path. I'll write more about function for path string processing and the concept of current directory soon...