UserName plugin for Take Command / TCC / TCC/LE

beta version 0.99.1     2023-10-13

Charles Dye

Purpose:

This plugin provides two new functions, @COMPUTERNAME and @USERNAME, which return the computer name and the user name in a variety of different formats.

Installation:

To use this plugin, copy UserName.dll to some known location on your hard drive. (If you are still using the 32-bit version of Take Command, take UserName-x86.dll instead of UserName.dll.) Load the .DLL file with a PLUGIN /L command, for example:

plugin /l c:\bin\tcmd\test\plugin.dll

If you copy the .DLL file to a subdirectory named PlugIns within your Take Command program directory, it will be loaded automatically when TCC starts.

Plugin Features:

New functions: @COMPUTERNAME, @USERNAME

Syntax Note:

The syntax definitions in the following text use these conventions for clarity:

BOLD CODEindicates text which must be typed exactly as shown.
CODEindicates optional text, which may be typed as shown or omitted.
Bold italicnames a required argument; a value must be supplied.
Regular italicnames an optional argument.
ellipsis…after an argument means that more than one may be given.

New Functions:

@COMPUTERNAME — Returns the computer name in the specified format.

Syntax:
%@COMPUTERNAME[n]

nthe format to use:
0 — NetBIOS format
1 — DNS hostname format
2 — DNS domain name format
3 — fully-qualified DNS format
4 — NetBIOS format (physical)
5 — DNS hostname (physical)
6 — DNS domain name (physical)
7 — fully-qualified DNS (physical)

If n is not given, the default is 0, NetBIOS format.

This function calls the Windows GetComputerNameEx() function. The format value n is a member of the COMPUTER_NAME_FORMAT enumeration.



@USERNAME — Returns the user’s name in the specified format.

Syntax:
%@USERNAME[n]

nthe format to use:
1 — fully-qualified domain name
2 — SAM-compatible format
3 — display name
6 — unique ID (GUID)
7 — canonical format
8 — user principal format
12 — DNS domain format
  
128 — first word of the display name
129 — last word of the display name
130 — first word of the display name, only if there’s more than one
131 — middle words of the display name, only if there are more than two

If n is not given, the default is 2, SAM-compatible format.

This function calls the Windows GetUserNameEx() function. The format value n is a member of the EXTENDED_NAME_FORMAT enumeration.



Startup Message:

This plugin displays an informational line when it initializes. The message will be suppressed in transient or pipe shells. You can disable it for all shells by defining an environment variable named NOLOADMSG, for example:

set /e /u noloadmsg=1

Status and Licensing:

Consider this beta software. It may well have issues. Try it at your own risk. If you find a problem, you can report it in the JP Software support forum.

UserName is currently licensed only for testing purposes. I may make binaries and source code available under some free license once I consider it ready for use.

Download:

You can download the current version of the plugin from http://charlesdye.net/dl/username.zip.