I have an app to set the registry settings for word and want to set the startup and template directories to O:\%NWUSERNAME%\

It does not set these in the file locations. If I set it to just O:\ it works. I have run the set command in a dos prompt and the username is set correctly