# Position of -nthreads N in for\_each command

**URL:** https://community.mrtrix.org/t/position-of-nthreads-n-in-for-each-command/8740
**Category:** Uncategorized
**Created:** [April 10, 2026, 8:01pm UTC](https://community.mrtrix.org/t/position-of-nthreads-n-in-for-each-command/8740 "2026-04-10T20:01:18Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![almatuschak](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/a/dfb087/32.png) [@almatuschak](https://community.mrtrix.org/u/almatuschak)
#### Post date: [April 10, 2026, 8:01pm UTC](https://community.mrtrix.org/t/position-of-nthreads-n-in-for-each-command/8740/1 "2026-04-10T20:01:18Z")

</div>

Hi! I was looking at the MRtrix wiki for batch processing ( [Batch processing with for\_each — MRtrix3 3.0 documentation](https://mrtrix.readthedocs.io/en/latest/tips_and_tricks/batch_processing_with_foreach.html) ) and found that it says the following:

_Indeed these two usages can in theory be combined. Imagine that a hypothetical MRtrix3 command, “`dwidostuff`”, tends to not be capable in practise of utilising any more than four threads, regardless of how many threads are in fact available on your hardware / explicitly invoked. However you have a system with eight hardware threads, and wish to utilise them all as much as possible. In such a scenario, you could use:_

```auto
for_each study/* -nthreads 2 : dwidostuff IN/dwi.mif IN/dwi_stuffdone.mif -nthreads 4

```

However, the line _for\_each study/\* -nthreads 2 :_ did not work for me until I changed it to \*for\_each -nthreads 2 study/\* :  
\*  
So I was wondering if this is an error in the documentation or if I was doing something wrong?  
Thank you for your response!
