# How to use command line run slicer's models

**URL:** <https://discourse.slicer.org/t/how-to-use-command-line-run-slicers-models/18427>\
**Category:** Support\
**Created:** [June 30, 2021, 12:13pm UTC](https://discourse.slicer.org/t/how-to-use-command-line-run-slicers-models/18427 "2021-06-30T12:13:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lyhsky123](https://avatars.discourse-cdn.com/v4/letter/l/edb3f5/32.png) [@lyhsky123](https://discourse.slicer.org/u/lyhsky123)\
**Post date:** [June 30, 2021, 12:13pm UTC](https://discourse.slicer.org/t/how-to-use-command-line-run-slicers-models/18427/1 "2021-06-30T12:13:34Z")

</div>

When I use Mac command line to run this:

/Applications/Slicer.app/Contents/MacOS/Slicer --launch ResampleScalarVolume -i linear -s 1,1,1   
$CoregPath/Coreg\_$MRI.nii.gz   
$CoregPath/CoregResamp\_$MRI.nii.gz

It always switches to the ‘Welcome’ model automatedly.  
Does anyone know how to use the command line, comes into ‘ResampleScalarVolume’ model?

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [June 30, 2021, 12:37pm UTC](https://discourse.slicer.org/t/how-to-use-command-line-run-slicers-models/18427/2 "2021-06-30T12:37:33Z")

</div>

The `--launch` option is used to run another program in Slicer’s environment (e.g. paths and settings).

You want to use the `--python-code` option like this to set the module:

./Slicer-4.13.0-2021-06-28-linux-amd64/Slicer --python-code “slicer.util.selectModule(‘SegmentEditor’)”

---

<div class="post-metadata">

**Author:** ![lyhsky123](https://avatars.discourse-cdn.com/v4/letter/l/edb3f5/32.png) [@lyhsky123](https://discourse.slicer.org/u/lyhsky123)\
**Post date:** [June 30, 2021, 1:44pm UTC](https://discourse.slicer.org/t/how-to-use-command-line-run-slicers-models/18427/3 "2021-06-30T13:44:10Z")

</div>

Thank you for your help~
