[workflow-plugin] Determine current directory

144 views
Skip to first unread message

Rupali

unread,
Dec 5, 2014, 8:11:08 AM12/5/14
to jenkins...@googlegroups.com
Hi,

I am using workflow plugin and in one of the workflow steps, I would like to know my current directory (full path) and use that in my bat script.
I tried using pwd command but it gives below error:

groovy.lang.MissingPropertyException: No such property: pwd for class: WorkflowScript

Can someone advise on how to read current directory path into a variable which I can use in my bat script?

Regards,
Rupali

James Nord

unread,
Dec 5, 2014, 8:55:51 AM12/5/14
to jenkins...@googlegroups.com
Hi Rupali

The following should work

node('windows') {
  def myDir = pwd
  bat "echo ${myDir}"
}
/James

Rupali

unread,
Dec 5, 2014, 9:30:16 AM12/5/14
to jenkins...@googlegroups.com
Hi James,

Thanks for quick reply. I tried this. But I get same exception.

Regards,
Rupali

James Nord

unread,
Dec 5, 2014, 11:28:52 AM12/5/14
to jenkins...@googlegroups.com
try

node('windows') {
  def myDir = pwd()

  bat "echo ${myDir}"
}

/James

--
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-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/9ec52e6b-e43f-4e5a-880b-e804b9d0ddba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rupali

unread,
Dec 8, 2014, 3:08:12 AM12/8/14
to jenkins...@googlegroups.com
Hi James,

That worked. Thanks.

Regards,
Rupali

Jesse Glick

unread,
Jan 8, 2015, 1:06:12 PM1/8/15
to jenkins...@googlegroups.com
On Monday, December 8, 2014 3:08:12 AM UTC-5, Rupali wrote:
That worked.

Reply all
Reply to author
Forward
0 new messages