Consider the following scenario:
Notes
- You use a user account (user account A) to log on to a Windows Server 2008 SP2-based computer.
- You create a system environment variable that refers to the COMPUTERNAME environment variable. For example, you create the system environment variable by following these steps:
- In the search box in Control Panel, you type Advanced system settings. Then, you click System Properties.
- On the Advanced tab, you click Environment Variables.
- You create a new system variable by using the name "sample" and the variable value "%computername%."
- You press Ctrl+Alt+Del to switch to another user account on the computer.
- You switch back to user account A.
- You open a command prompt from the Start menu or by running cmd.exe from the Search programs and files search box. Then, you try to verify the system variable by running the following command:
echo %sample%
Notes
- You expect the command to return the computer name.
- This issue occurs only when you open the command prompt from the Start menu or by running cmd.exe from the Search programs and files search box. For example, if you open a command prompt from Windows Task Manager, this issue does not occur.