I worked this out with 

def jobBaseName = "${env.JOB_NAME}".split('/').last()
echo "Job Name (excl. path): ${jobBaseName}"


Thanks Dirk for the code snippet that helped speed up the solution!


On Wednesday, 25 January 2017 10:38:32 UTC, Mark Allison wrote:
>
> I want to use the ${JOB_NAME} environment variable on my Windows slave, 
> however my project is in a folder in Jenkins and I want to exclude the 
> folder. How can I use %JOB_NAME% without the folder name?
>
> Thanks
> -- 
>
> Sent from my phone 
>

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/9f19c840-62e3-40b9-b09e-26c5a04457cc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to