I\'m getting this exception when using Substring:
Exception calling \"Substring\" with \"2\" argument(s): \"Index an
If the last character of the string is all you want, you can achieve this by simply treating the string as an array of chars and use the according index notation:
'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\hid\Parameters\0'[-1]