MatchToken function (netsh.h)

The MatchToken function determines whether a user-entered string matches a specific string. A match exists if the user-entered string is a case-insensitive prefix of the specific string.


BOOL MatchToken(
  [in] LPCWSTR pwszUserToken,
  [in] LPCWSTR pwszCmdToken


[in] pwszUserToken

A string entered by the user.

[in] pwszCmdToken

A string against which to check for a match.

Return value

Returns TRUE if there is a match, FALSE if not.


The MatchToken function is generally used by command functions. For arguments with an enumerated set of possible values, use the MatchEnumTag function instead.

One example of using MatchToken is a command function that has an argument whose value can be an integer or the string "default". That command function might use MatchToken to test whether the value matches the string "default" before interpreting it as an integer.


Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header netsh.h
Library Netsh.lib
DLL Netsh.exe

See also