Pull requests / #1568

#1568 Fix PowerShell 5.1 command shown by UPDATE.bat

open · @BonifacioCalindoro · 0 评论 · 在 GitHub 查看

Windows

描述

## Fix PowerShell 5.1 compatibility of recovery instructions

`UPDATE.bat` currently prints this command when a clone needs to be moved to the new repository history:

```text
git branch pre-cleanup-backup && git stash push
```

This is valid in PowerShell 7, but not in Windows PowerShell 5.1. Windows 11 can still launch Windows PowerShell 5.1 by default, so users can encounter a parser error when copying the command from the script:

```text
The token '&&' is not a valid statement separator in this version.
```

The `.bat` itself does not need to change its use of `&&`: the problematic `&&` is inside an `echo` and is intended to be copied and executed by the user in their shell.

This change prints the two commands separately instead:

```text
git branch pre-cleanup-backup
git stash push
```

This works in both Windows PowerShell 5.1 and newer PowerShell versions, while also avoiding a shell-specific operator in instructions intended for manual execution.

No behavior of the update script itself is changed.

Fixes #1566 

站内延伸阅读

链到安装、模型与版本说明,便于 SEO/GEO,非官方 issue 正文。