Getting powershel script step path

I’m trying to figure out how can I obtain currently executed PS step path.
I’m trying to write a file into from a variable and since step folder will be deleted, that would also delete my created file (desired outcome).
Thank you.


Thanks for reaching out. The variable $PSScriptRootPath will always return the parent path of the current script. Using the variable from a Powershell step would return something similar to


Let me know if this is what you are looking for.



Thank you Dalmiro.
That will require PS3, but that’s exactly it. Is my assumption that the file will be wiped along with the temp folder octopus script step is generating correct?

Dalmiro, I worked around my problem using ".\file.xml"
Since I need to store contents of variable in a file relative to executed PS script file, that worked nicely.
Thanks again.