How to get login username on Windows

hardcoder's icon

Hi all,
after searching for a long time now...

How do you actually get the login username in javascript or else like you would get it by typing to the windows cmd:

echo %username%
hardcoder's icon

I tried it now with node.js using [node.script getUserName.js @autostart 1].

Here is the content of getUserName.js:

const Max = require('max-api');
const os = require('os');

Max.outlet(os.userInfo().username);