I am wanting to create a new environmental variable named something like shortname and have the value be %COMPUTERNAME:~0,-2%.
I want to be able to type echo %shortname% and see the computer name minus the last two characters.
I tried creating the environment variable by entering in "%COMPUTERNAME:~0,-2%." as the value (under environmental variables in Advanced system settings but it literally echoed "%COMPUTERNAME:~0,-2%."
How can I achieve this? My client OS is Windows 7. My end goal is to be able to use this variable in group policy preferences. I am wanting to deploy a registry key where the value of the registry key is the computer name minus the last two characters of the name.