I believe you would have to have it as follows: 



JOB_NAME = ${JOB_NAME} 



This creates the JOB_NAME as the environment variable that is set to the actual 
Job name in Jenkins. 



Now it will depend on the type of script you are using to be able to refer to 
the variable. 



If it is a batch script then you should be able to reference it with:  
%JOB_NAME% 



If it is a powershell script then you should be able to reference it with:  
$env:JOB_NAME 





Hope this helps 



----- Original Message -----


From: "zw" <[email protected]> 
To: [email protected] 
Sent: Wednesday, May 29, 2013 2:43:31 PM 
Subject: Re: How to set custom Windows Environment Variable in a job - quick 
question 

Hi KT 


Thanks for responding. 
Should it be  JOB_NAME=%JOB_NAME% in that checkbox? 


Apologise for simple question like this. 


On Wednesday, May 29, 2013 5:35:16 AM UTC-7, KT wrote: 



I don't think you need a plugin for this.  There should be a checkbox under the 
"Build Environment" section of the job called "Set Environment Variables"  
There, I believe you should be able to do JOB_NAME=$JOB_NAME 


From: "Z W" < [email protected] > 
To: [email protected] 
Sent: Tuesday, May 28, 2013 10:33:08 PM 
Subject: How to set custom Windows Environment Variable in a job - quick 
question 


Hi All 


We have a windows job and we like to set environment variable like in linux. 
But we can't find a configuration plugin checkbox to allow us to set a window 
environment variable. 
Eg: 


We like to set a JOB_NAME to a variable for this windows job such that this 
JOB_NAME can be used in a post-action task. Right now, ${JOB_NAME} or 
%JOB_NAME% is not working in the script section of post-action task. 


Thanks again. 
Sincerely 

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group. 
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected] . 
For more options, visit https://groups.google.com/groups/opt_out . 
  
  




-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group. 
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected]. 
For more options, visit https://groups.google.com/groups/opt_out . 
  
  

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to