# Where to write a command

**URL:** <https://discourse.julialang.org/t/where-to-write-a-command/63512>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [June 24, 2021, 7:49pm UTC](https://discourse.julialang.org/t/where-to-write-a-command/63512 "2021-06-24T19:49:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amro](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Amro](https://discourse.julialang.org/u/Amro)\
**Post date:** [June 24, 2021, 7:49pm UTC](https://discourse.julialang.org/t/where-to-write-a-command/63512/1 "2021-06-24T19:49:15Z")

</div>

Hello,

I am trying to implement the same steps as in:

> **[Announcing composable multi-threaded parallelism in Julia](https://julialang.org/blog/2019/07/multithreading/)**
>
> Announcing composable multi-threaded parallelism in Julia | Software performance depends more and more on exploiting multiple processor cores....

 ![image](https://global.discourse-cdn.com/julialang/original/3X/8/0/8071f0aaad2c3baade50fa4da6f7c97044c7f593.png)

But I didnot know where to write this command:

_$ for n in 1 2 4 8 16; do JULIA\_NUM\_THREADS=$n ./julia psort.jl; done_

is it in the PowerShell?  
Thanks

---

<div class="post-metadata">

**Author:** ![MatFi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/matfi/32/10002_2.png) [@MatFi](https://discourse.julialang.org/u/MatFi)\
**Post date:** [June 24, 2021, 8:08pm UTC](https://discourse.julialang.org/t/where-to-write-a-command/63512/2 "2021-06-24T20:08:38Z")

</div>

> [@Amro](#):
>
> $ for n in 1 2 4 8 16; do JULIA\_NUM\_THREADS=$n ./julia psort.jl; done

This is a shell command you have to type into a “bash”, “zsh” or similar shell. There is a windows pendant in powershell, which could be something like

```julia
int base = 2;
for (n = 0 ; n -le 4 ; n++)
{
    $Env:JULIA_NUM_THREADS=$"{(long)Math.Pow(base, n):N0}"
     julia psort.jl
} 

```

but not sure about the environment variable “JULIA\_NUM\_THREADS” and do not have access to a windows machine right now to test it

---

<div class="post-metadata">

**Author:** ![Amro](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Amro](https://discourse.julialang.org/u/Amro)\
**Post date:** [June 24, 2021, 8:20pm UTC](https://discourse.julialang.org/t/where-to-write-a-command/63512/3 "2021-06-24T20:20:35Z")

</div>

Thank you for your reply.  
I am not sure if I get you right. Do I need to write this code

> [@MatFi](#):
>
> ```julia
> int base = 2;
> for (n = 0 ; n -le 4 ; n++)
> {
> $Env:JULIA_NUM_THREADS=$"{(long)Math.Pow(base, n):N0}"
> julia psort.jl
> } 
> 
> ```

in the PowerShell, similar in the below?

 ![44](https://global.discourse-cdn.com/julialang/original/3X/e/0/e023db7226a7630e33e27055bf573d8fa94069c0.png)

---

<div class="post-metadata">

**Author:** ![MatFi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/matfi/32/10002_2.png) [@MatFi](https://discourse.julialang.org/u/MatFi)\
**Post date:** [June 24, 2021, 8:32pm UTC](https://discourse.julialang.org/t/where-to-write-a-command/63512/4 "2021-06-24T20:32:30Z")

</div>

Yes, but my example I gave you is flawed, you have to look on you own how to do this e.g [here](https://docs.microsoft.com/en-us/learn/modules/script-with-powershell/)

---

<div class="post-metadata">

**Author:** ![Amro](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Amro](https://discourse.julialang.org/u/Amro)\
**Post date:** [June 24, 2021, 8:35pm UTC](https://discourse.julialang.org/t/where-to-write-a-command/63512/5 "2021-06-24T20:35:35Z")

</div>

I got you.  
Thank you very much!
