- 1 year ago
edit PATH variable using command line in widows 10
To edit the PATH variable using the command line in Windows 10, you can use the setx
command or modify it directly with the set
command. Here are the steps for both methods:
Open a command prompt with administrative privileges:
- Press
Win + X
on your keyboard. - From the Power User menu, select "Command Prompt (Admin)" or "Windows PowerShell (Admin)".
- Press
To use the
setx
command to edit the PATH variable, enter the following command:arduinosetx PATH "new_path;%PATH%"
Replace "new_path" with the desired directory you want to add to the PATH. The
%PATH%
ensures that the existing PATH variable is preserved and appended with the new directory.Note: After running the
setx
command, you need to open a new command prompt for the changes to take effect.Alternatively, you can modify the PATH variable directly using the
set
command. Enter the following command:arduinoset PATH=%PATH%;new_path
Replace "new_path" with the desired directory you want to add to the PATH.
Note: This change is only effective within the current command prompt session and doesn't persist across sessions.
Verify the changes by running the following command:
bashecho %PATH%
This will display the updated PATH variable, including the new directory you added.
Remember that modifying the PATH variable affects the system-wide environment variable, allowing you to run executables located in the specified directories from any command prompt. Be cautious while editing the PATH variable to avoid accidentally removing important directories or introducing errors.