# How to control a running slicer from the command line

**URL:** https://discourse.slicer.org/t/how-to-control-a-running-slicer-from-the-command-line/28464
**Category:** Support
**Created:** [March 20, 2023, 5:22am UTC](https://discourse.slicer.org/t/how-to-control-a-running-slicer-from-the-command-line/28464 "2023-03-20T05:22:22Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![slicer365](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/slicer365/32/67549_2.png) [@slicer365](https://discourse.slicer.org/u/slicer365)
#### Post date: [March 20, 2023, 5:22am UTC](https://discourse.slicer.org/t/how-to-control-a-running-slicer-from-the-command-line/28464/1 "2023-03-20T05:22:22Z")

</div>

I know how to use the python console to control slicer.

But now I want to control the python console through an external program,  
My idea is to control the python console by entering commands through cmd, and then control the slicer scene.

How to achieve it?

For example, I want to print “HelloWorld” in the current python console through the cmd command.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/4/4/442dbd9052ea44b6d321303ff4cee902c15322a0.png)

---

<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: [March 20, 2023, 4:17pm UTC](https://discourse.slicer.org/t/how-to-control-a-running-slicer-from-the-command-line/28464/2 "2023-03-20T16:17:35Z")

</div>

You can use the WebServer module for this:

[https://slicer.readthedocs.io/en/latest/user\_guide/modules/webserver.html#remote-control](https://slicer.readthedocs.io/en/latest/user_guide/modules/webserver.html#remote-control)
