Get PC User Name

Hi,

Does anyone know how to get the PC user name (not the the Revit user name)?

Trying to do a Dynamo script for the office but need a way to output to a folder on a users desktop so need to know the user name to complete the file path.

Thanks

You will need to code something in python using the “os” python module.

Info on module: https://docs.python.org/2/library/os.html

Module will be saved in this location on your pc and will need to reference it from here: C:\Program Files (x86)\IronPython 2.7\Lib

Or

Another way to get the users desktop directory would be to do something along these lines: https://stackoverflow.com/questions/34275782/how-to-get-desktop-location-using-python

3 Likes

Thanks Brendan for pointing me in the right direction.

Python

4 Likes