I have found that Smart Ink Tools Addin for Office 2010 fails to load properly if the user is prompted to enter a Username and Userinitials when an Office product is first started. In the effort to prevent this prompt from happening, I have found that some registry values need to be present. Namely:


Configuring these values as a REG_EXPAND_SZ allows me to user the %username% variable as such:

reg add HKCU\Software\Microsoft\Office\Common\Userinfo /v Username /t REG_EXPAND_SZ /d "%%username%%" /f

Which ends up working great. When I start Office, the REG_EXPAND_SZ is expanded, and is replaced with a REG_SZ equal to the username.

However, I am having an issue with the UserInitials part. My attempt is:

reg add HKCU\Software\Microsoft\Office\Common\Userinfo /v Username /t REG_EXPAND_SZ /d "%%username:~0,2%%" /f

Which should get the first two characters of the Username variable. This works when testing in a cmd prompt, but when the REG_EXPAND_SZ ends up expanding, it only drops the first character in the resulting REG_SZ. I tried %username:~0,3% with the same results.

Does anybody know what is going on here?


Tested with %username% as the value for both UserName and UserInitials, and found that it preserved the keys (not replacing them as I had thought). It seems that the issue is with regards to the substring selection idea, %username:~0,2%. If I have that configured as one of the values, it fails entirely and replaces my keys with the default keys, which is the username, and then the initials.  

Answer Summary:
REG_EXPAND_SZ does not support substring functionality. Ended up copying batch file to system and creating a RunOnce value for the default user so that each user executes the script at first login.
0 Comments   [ + ] Show Comments


Please log in to comment



The below works for me with no issues.  I changed the values back to REG_SZ and used the UserName variable just like you wanted.

reg add HKCU\Software\Microsoft\Office\Common\Userinfo /v UserName /t REG_SZ /d %username% /f
reg add HKCU\Software\Microsoft\Office\Common\Userinfo /v UserInitials /t REG_SZ /d %username:~0,2% /f
Answered 03/20/2013 by: M P
Purple Belt

  • This works if you run the script in user context, but doesn't accomplish the same thing if you want to load the keys in the default user profile, which is what I was trying to accomplish.
    • Gotcha, checking on that now.
    • After reviewing the documentation for REG_EXPAND_SZ values, you are not able to use the substring functionability. It looks like your best bet would be to use this command in a logon script in your environment or something similar.

      Note that this function does not support all the features that Cmd.exe supports. For example, it does not support %variableName:str1=str2% or %variableName:~offset,length%.

      • Thanks! I even looked at the article you linked but failed to pick up on the relevant passage, indicating substring functionality as unsupported.

        I ended up having the script execute from RunOnce.
Please log in to comment
Answer this question or Comment on this question for clarity
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja