If you’re a coder or programmer, you probably spend a decent amount of time using the command prompt to execute programs or compile code. In order to complete those tasks, you most likely have to use a command from a library or software package installed (like Python) on your system.
By default, most of these programs will add their own custom shortcuts to the Windows environment variables. The most used environment variable in Windows is probably the මාර්ගය variable. It basically allows you to run any executables that are located inside the paths specified in the variable at the command prompt without having to give the full path to the executable.
In this article, I’ll show you how you can add more paths to the Windows PATH variable in case you want to run executables from your own custom directories. It’s worth noting that the procedure below is for Windows 10, but it’s almost exactly the same for Windows 7 also.
Add Directories to PATH Variable
To get started, right-click on the පරිගණක or මෙම පරිගණකය icon on the desktop and select දේපළ. If you don’t have that icon on your desktop already, you can add any missing desktop icons පහසුවෙන්.
මත පද්ධතිය dialog page, you’ll see an උසස් පද්ධති සැකසුම් link on the left-hand side.
මෙය ගෙන එනු ඇත පද්ධති ගුණාංග dialog, which should already be open to the උසස් tab. Go ahead and click on the පාරිසරික විචල්යයන් බොත්තම ඉතා පතුලේ.
මත පාරිසරික විචල්යයන් dialog, you’ll see two sets of variables: one for user variables and the other for system variables. Both lists have the මාර්ගය variable, so you have to decide which one to edit.
If you only need the commands for your own user account, then edit the user variable. If you need it to work across the computer system regardless of which user is logged in, then edit the system variable. Click on මාර්ගය ඉන්පසු ක්ලික් කරන්න සංස්කරණය කරන්න.
මත පරිසර විචල්යය සංස්කරණය කරන්න dialog, you’ll see a list of all the paths that are currently in the PATH variable. As you can see, Node.js and Git already added their paths so that I can run Git commands and Node.js commands from anywhere while in the command prompt.
To add a new path, simply click on අලුත් and it’ll add a new line to the bottom of the list. If you know the path, simply type it in or copy and paste it. If you prefer, you can also click ගවේශක and then navigate to the desired path.
To edit any path, simply select it and then click on the සංස්කරණය කරන්න button. You can also delete paths using the Delete button. Note that you can also move items up and down on the list. When you type a command at the command prompt, Windows has to search through each directory stored in the PATH variable to see if that executable exists or not. If you want your executable to be found faster, just move that path up to the top of the list.
This can also come in handy if you have multiple versions of the same command in different paths and need to have one run instead of the other. The one that shows up higher in the list will be run when you type in the command.
Lastly, if you click on පෙළ සංස්කරණය කරන්න, it will load a dialog where you can edit the Path variable using the old interface where all the paths are listed in one text box.
That’s all there is to it! If you want to learn more about environment variables, make sure to check out my post on how to create your own custom environment variables. සතුටින්!