Dynare uses the NSIS installer. According to Command Line Usage, you can use
- /D sets the default installation directory ($INSTDIR), overriding InstallDir and InstallDirRegKey. It must be the last parameter used in the command line and must not contain any quotes, even if the path contains spaces. Only absolute paths are supported.
I tried
dynare-5.4-win.exe /S /D=C:\Program Files\Dynare\5.4
and it works like a charm.