# Running a python script in slicer

**URL:** <https://discourse.slicer.org/t/running-a-python-script-in-slicer/35019>\
**Category:** Development\
**Tags:** python\
**Created:** [March 22, 2024, 10:31am UTC](https://discourse.slicer.org/t/running-a-python-script-in-slicer/35019 "2024-03-22T10:31:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matteboo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/matteboo/32/66548_2.png) [@Matteboo](https://discourse.slicer.org/u/Matteboo)\
**Post date:** [March 22, 2024, 10:31am UTC](https://discourse.slicer.org/t/running-a-python-script-in-slicer/35019/1 "2024-03-22T10:31:44Z")

</div>

Hello,

I’m trying to run a python script using slicer  
I tried

```auto
>>> C:\Users\matte\AppData\Local\slicer.org\Slicer 5.6.0\Slicer.exe --python-script "C:\Users\matte\Documents\Matteo\script\hello_world.py"
  File "<console>", line 1
    C:\Users\matte\AppData\Local\slicer.org\Slicer 5.6.0\Slicer.exe --python-script "C:\Users\matte\Documents\Matteo\script\hello_world.py"
       ^
SyntaxError: unexpected character after line continuation character
>>> "C:\Users\matte\AppData\Local\slicer.org\Slicer 5.6.0\Slicer.exe"--python-script "C:\Users\matte\Documents\Matteo\script\hello_world.py"
  File "<console>", line 1
    "C:\Users\matte\AppData\Local\slicer.org\Slicer 5.6.0\Slicer.exe"--python-script "C:\Users\matte\Documents\Matteo\script\hello_world.py"
                                                                     ^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

```

I read [Run python script from command line not working](https://discourse.slicer.org/t/run-python-script-from-command-line-not-working/22453) without finding a solution

I’m familiar with coding but I’m new to coding using slicer, if you have any ressources that I could use, I would be very grateful

---

<div class="post-metadata">

**Author:** ![Matteboo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/matteboo/32/66548_2.png) [@Matteboo](https://discourse.slicer.org/u/Matteboo)\
**Post date:** [March 22, 2024, 12:53pm UTC](https://discourse.slicer.org/t/running-a-python-script-in-slicer/35019/2 "2024-03-22T12:53:48Z")

</div>

I found the solution, I needed to type the command in the **Window** command line **not** in the **slicer** command line
