Actually I would go with the Environment. getenv() is a standard library function and so is probably the only potentially portable way to do this. The trick is figuring out what variables are unique to all OSes. Windows has ComSpec, appdata, Windir, systemroot and systemdrive which should be set. You could also strstr the path variable for WINDOWS or WINNT but that might not be accurate. I'm not Linux shell/Solaris/MacOS expert so someone else might be able to tell you what "standard" environment variables exist in those OSes. CygWin may cause you some issues, too.