Hi Kohsuke,

I am new to Groovy. So I guess I couldn't figure out the issue.
But setting env.MYDIR and accessing it as %MYDIR% in batch script worked.
Thanks for quick response.

Regards,
Rupali

On Monday, December 8, 2014 9:35:29 PM UTC+5:30, Kohsuke Kawaguchi wrote:
>
> I've never used 2x doublequote string in Groovy, but in any case this 
> sounds like a Groovy question.
>
> Aside from String formatting like ${...}, you can also explicitly set a 
> value to environment variable by:
>
>    env.MYDIR= pwd()
>
> then every process forked within the block scope will have such an 
> environment variable set.
>
>
> 2014-12-08 1:09 GMT-08:00 Rupali <[email protected] <javascript:>>:
>
>> Hi,
>>
>> I tried reading variables in batch script. It works if its a single line 
>> batch code, but doesn't for multiple lines.
>>
>> e.g.
>>
>> Below outputs current directory path correctly.
>> node('windows') {
>> def myDir = pwd()
>> bat "echo ${myDir}"
>> }
>>
>> But below produces output as *Current directory is: ${myDir}*
>> node('windows') {
>> def myDir = pwd()
>> bat '''echo "Current directory is:"
>> echo ${myDir}'''
>> }
>>
>> Am I missing some syntax in multiple line batch script?
>>
>> Regards,
>> Rupali
>>
>> -- 
>> 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] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/a8162919-a986-463a-ad1d-a54c1d75d352%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/a8162919-a986-463a-ad1d-a54c1d75d352%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Kohsuke Kawaguchi
>  

-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/1a719d3f-55c3-40f9-8e6f-8be358848556%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to