diff --git a/Common/CommandLine.cpp b/Common/CommandLine.cpp
index f9c9074a7f893edec370c6e2d297173a2092f3ec..2bcb113752ef2857041a8e2e080b128a1da15ca4 100644
--- a/Common/CommandLine.cpp
+++ b/Common/CommandLine.cpp
@@ -137,9 +137,7 @@ void GetOptions(int argc, char *argv[])
   }
 #endif
 
-  std::string execName="gmsh";
-  if(execName.size())
-    Msg::SetExecutableName(execName);
+  Msg::SetExecutableName(argc?argv[0]:"");
 
   // get command line options
   int i = 1;