# set work directory in VMTK/Pypes?

**URL:** <https://discourse.slicer.org/t/set-work-directory-in-vmtk-pypes/16563>\
**Category:** VMTK\
**Created:** [March 16, 2021, 4:34am UTC](https://discourse.slicer.org/t/set-work-directory-in-vmtk-pypes/16563 "2021-03-16T04:34:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MPP](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mpp/32/10303_2.png) [@MPP](https://discourse.slicer.org/u/MPP)\
**Post date:** [March 16, 2021, 4:34am UTC](https://discourse.slicer.org/t/set-work-directory-in-vmtk-pypes/16563/1 "2021-03-16T04:34:35Z")

</div>

Hi all,

Is it possible to set a work directory and switch to this directory at the start of a text file containing a list of VMTK commands?

I developed a vmtk for an older version of VMTK that I could still easily launch from the command line on ubuntu, but with the new version forcing me to switch I don’t see how I can tell VMTK to look for the input files in the correct directory, and to save the output files in the correct directory.

Or is there a way on windows to launch vmtk in a specific working directory already?

I don’t want to explicitly program the full directory path in each -ifile or -ofile command, because I need to execute this script in multiple directories, so I dont want to have to change each line of my script every time I execute it.

Thanks in advance,  
MPP

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [March 26, 2021, 3:30am UTC](https://discourse.slicer.org/t/set-work-directory-in-vmtk-pypes/16563/2 "2021-03-26T03:30:17Z")

</div>

On Windows, you can use %cd% as a placeholder for the current directory, for example `... -ifile %cd%/something.vtp ...`.
