Nilesoft Shell Pro GitHub

USER


user.name

Returns the current username.

Syntax

user.name
user.groups

Without arguments, returns the groups the current user is in, as an array of names (a group whose name Windows can't find is given by its SID). With arguments, returns true when the user is in any of the groups named.

A group can be named as 'Administrators', 'BUILTIN\Administrators' or by its SID, such as 'S-1-5-32-544'. Names don't care about case. Group names follow the Windows language, so a SID is the safer choice in a snippet you share.

Only groups that are switched on count. When File Explorer runs without administrator rights (the usual case), Administrators is there for deny only, so user.groups('Administrators') is false even for an administrator account.

Syntax

user.groups                                   // array of group names
user.groups('Administrators')                 // true when in Administrators
user.groups('S-1-5-32-544', 'Remote Desktop Users')  // true when in any of them

Example

item(title='Build tools' where=user.groups('Developers') cmd='cmd.exe')
item(title='Groups' cmd=msg(str.join(user.groups, ', ')))
Functions to return the path of user directories

Syntax

user.home
user.appdata
user.contacts
user.desktop
user.directory (user.dir)
user.documents
user.documentslibrary
user.downloads
user.favorites
user.libraries
user.localappdata
user.music
user.personal
user.pictures
user.profile
user.quicklaunch
user.sendto
user.startmenu
user.temp
user.templates
user.videos