# Allow ExternalProject\_Add to run commands with PowerShell or MSys2 on Windows

**URL:** https://discourse.cmake.org/t/allow-externalproject-add-to-run-commands-with-powershell-or-msys2-on-windows/11090
**Category:** Development
**Created:** [June 24, 2024, 10:46am UTC](https://discourse.cmake.org/t/allow-externalproject-add-to-run-commands-with-powershell-or-msys2-on-windows/11090 "2024-06-24T10:46:20Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Gonzalo\_Garramuno](https://discourse.cmake.org/user_avatar/discourse.cmake.org/gonzalo_garramuno/32/265_2.png) [@Gonzalo\_Garramuno](https://discourse.cmake.org/u/Gonzalo_Garramuno)
#### Post date: [June 24, 2024, 10:46am UTC](https://discourse.cmake.org/t/allow-externalproject-add-to-run-commands-with-powershell-or-msys2-on-windows/11090/1 "2024-06-24T10:46:21Z")

</div>

ExternalProject\_Add() will, on Windows, run commands through a .bat file (for cmd.exe) when it seems the line is long. This is really good and tends to work really well.  
Unfortunately, when compiling FFmpeg, I am currently also running into Windows’ command-line length on .bat files, as I have too many codecs, demuxers, etc. turned on/off.  
It would be great if ExternalProject\_Add would run its commands (based on a user option perhaps) with either a PowerShell script or an MSys2 script, rather than a cmd.exe .bat file, as neither of those have command-line limitations I believe.

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [June 25, 2024, 7:36am UTC](https://discourse.cmake.org/t/allow-externalproject-add-to-run-commands-with-powershell-or-msys2-on-windows/11090/2 "2024-06-25T07:36:32Z")

</div>

We can’t just change the shell used to run commands. Despite warnings telling people not to do so, many projects rely on all sorts of behaviours of the shell that is currently used. Any change would break quite a lot of projects.

It may be possible to add an option to specify using a different shell, but I don’t have the bandwidth to explore or implement such a change myself (I’m probably the nominal maintainer of ExternalProject and FetchContent these days). If someone wants to take that up, I’d suggest they open a feature request in the issue tracker and discuss the proposal there first.
