How to add a folder to the PATH environment variable in a Windows agent

1 minute readKnowledge base

Issue

How to add a folder to the PATH environment variable in a Windows agent?

Resolution

To include a folder in the PATH environment variable on a Windows agent in Jenkins, you can follow these steps:

  • Open Jenkins Dashboard: Login into your Jenkins instance and navigate to the dashboard.

  • Access Node Configuration: Click on "Manage Jenkins" on the left-hand side menu, then select "Nodes".

  • Find the Windows agent you want to configure and click on its name.

  • On the agent’s configuration page, locate the section related to environment variables. It might be labeled as "Environment variables," "Node properties," or similar.

  • Look for the existing PATH variable in the environment variables section. If it doesn’t exist, create a new one (though this will override the default PATH variable from the Windows machine). If it already exists, append the path to the folder you want to include. Make sure to separate each folder with a semicolon.

  • For example, if you want to add C:\MyFolder to the PATH, and the current PATH is C:\Windows\System32, you would change it to C:\Windows\System32;C:\MyFolder.

  • After adding or modifying the PATH variable, save the configuration changes.

  • Restart the agent for the changes to take effect.

This article is part of our Knowledge Base and is provided for guidance-based purposes only. The solutions or workarounds described here are not officially supported by CloudBees and may not be applicable in all environments. Use at your own discretion, and test changes in a safe environment before applying them to production systems.