Issue
The bat
directive in Pipeline returns cmd is not recognized as an internal or external command, operable program or batch file.
Environment
-
CloudBees CI (CloudBees Core) on modern cloud platforms - Managed Master
-
CloudBees CI (CloudBees Core) on traditional platforms - Client Master
-
Pipeline running on a Windows environment
Resolution
- You need to make sure the user running the Jenkins Master/Agent where the command is executing has
C:\Windows\System32
in it’s PATH variable. - To add this to that user’s PATH, right click on My Computer then select Properties. Click Advanced then click Environment Variables.
Scroll down to PATH and addC:\Windows\System32
to it. - If the PATH is properly set but the error still appears, include the PATH through a environment variable. This is a known bug managed in https://issues.jenkins-ci.org/browse/JENKINS-44334.
environment {
env.PATH = env.PATH + ";c:\\Windows\\System32"
}
0 Comments