This article describes in detail the role of system variables and class path in windows environment. It also explains us how to set System Variables and System class path in Windows.
System variables are good, although we can work without them, but having them makes our life easy. It is a choice and not a compulsion.
System variables in windows are like names given to a location. Like if I want to refer the location C:\Program Files\Windows Media Player by the name player. It can be done by setting a system variable named player with the value C:\Program Files\Windows Media Player.
Please refer to the below images to set up the system variable.
Click on Advanced System Settings
Click on Environment Variables Button
Click on New under the System Variables, Just to bring into the notice, there is another section for user variables we don’t want that.
Add the variable name and value as shown below.
Save the settings by clicking Ok.
What is the use of setting system variables?
System variables are not powerful independently, but when we combine them with the system path variable, they can make our lives pretty easy.
Now if I want to play my media player without actually navigating through the folder structure (in case I don’t already have a shortcut on my desktop), I can use the command prompt to play the same.
I add the player variable in the system class path as follows:
Select the path variable under system variables and click Edit.
Add the variable name at the end of the path variable value. This is done by typing in ;%player%; at the end as shown below. Don’t miss the semi-colon.
Click Ok to save the settings.
Now that we have set up the player variable, we can try playing windows media player through command prompt.
Follow the following steps to open command prompt in the Administrator mode.
1) Click on Start button in Windows.
2) Type cmd and right click o the command window icon.
3) Click Run as Administrator and the command window will appear in the administrator mode.
4) On the command window type wmplayer and hit return to get the windows media player running.
We have successfully set up a system variable player to play windows media player.
Most of the time we open the command prompt in normal mode for a user. To make all the commands work in this mode you need to set the user variables and user path variables in the user variables section instead of system variables section as mentioned above.
Stay connected and stay Subscribed