Hey guys, I'm trying to write a script that will get the name of the computer the script is run on.
For instance, I have 4 different computers, and I want to have a script that writes to a text file to a centralized location (like a db) and records the name of the computer that it was written from.
At this point it looks like my only option is to create a file on the desktop when the script is run, grab the path, and delete the file. (since the name of the computer is included in the desktop path eg: /c/users/shawn/desktop) This seems backwards in the sense that it creates a file everytime the script runs to just delete it, but I can't seem to come up with any other solution. Anybody have an answer?
Get Username of Computer
Get Username of Computer
You don't have to create a file on the desktop then delete.
var userName = Folder('~').fsName.match(/[^\\]+$/);
var userName = Folder('~').fsName.match(/[^\\]+$/);