Process.platform returns \"win32\" for Windows. On Windows a user\'s home directory might be C:\\Users[USERNAME] or C:\\Documents and Settings[USERNAME] depending on which v
As mentioned in a more recent answer, the preferred way is now simply:
const homedir = require('os').homedir();
[Original Answer]: Why not use the USERPROFILE environment variable on win32?
USERPROFILE
function getUserHome() { return process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME']; }