0

I try to use jenkins to run a simple batch command from a jenkinsfile in my git repo:

  ...
  steps {
      script{
        bat "git status"
      }
   }
...

but it gives me always this error:

[Pipeline] script
[Pipeline] {
[Pipeline] bat
13:27:41 'cmd' n'est pas reconnu en tant que commande interne
13:27:41 ou externe, un programme ex‚cutable ou un fichier de commandes.
[Pipeline] }
[Pipeline] // script

In english : cmd is not recognized as an internal or external command, operable program or batch file.

I checked that jenkins was executed on the right windows node.

Have you any clue how to solve this ? thanks

Cyfell
  • 13
  • 1
  • 3
  • And my windows path contains "c:\windows\system32" – Cyfell Aug 26 '21 at 12:06
  • Hey, thank you for the reply ! I foud a solution with this previous post : https://stackoverflow.com/questions/54488509/jenkins-cmd-is-not-recognized It seems that Jenkins overwrite the PATH env variable by default. – Cyfell Aug 30 '21 at 19:11
  • It seems that Jenkins overwrite the PATH env variable by default with linux ones ? I specified every windows paths I need in the PATH env var in my jenkinsfile and it works now. this is not the best solution in my opinion. If you have a better one I ll be glad to know it ! – Cyfell Aug 30 '21 at 19:23

0 Answers0