[[Broot]]のターゲットに対して`cd`など親shellで実行する必要があるコマンドを可能にするためのコマンド。
## [[PowerShell]]の場合
[[Microsoft.PowerShell_profile.ps1]]ファイルに以下を追加する。
```powershell
function br() {
$outcmd = new-temporaryfile
broot -g --conf $env:USERPROFILE\broot.toml --outcmd $outcmd $args
if (!$?) {
remove-item -force $outcmd
return $lastexitcode
}
$command = get-content $outcmd
if ($command) {
# workaround - paths have some garbage at the start
$command = $command.replace("\\?\", "", 1)
invoke-expression $command
}
remove-item -force $outcmd
}
```
> [!info]
> `br`関数の内容は[[Broot-78 Paths on Windows are invalid]]で紹介されていたものを使用している。一番上で紹介されている方法はパスが見つからない問題にぶち当たるので、[lubieowoce氏の回避策](https://github.com/Canop/broot/issues/78#issuecomment-572631419)をベースにした。
## MOC
- 📚**ドキュメント**
- 📒**関連**
- 📖**ノウハウ**
- 💁**トラブルシューティング**
- [[📝Powershell 7.3.0からbrコマンドがエラーになる]]
- 🗃**用語定義**