Repository: flutter
Issue: Run `flutter` command failed after `flutter channel beta`
Labels: tool,team-tool

### Steps to reproduce

1. Follow [Flutter Docs](https://docs.flutter.dev/get-started/install) install VSCode, Flutter Extension, Dart Extension
  - Flutter SDK path: `D:\dev\flutter`
  - VSCode path: `D:\Program Files\Microsoft VS Code`
2. Run `flutter doctor`, output normally and successful, see **Flutter Doctor output** below.
3. Run `flutter channel beta` or `master` or `main`, output failed:
  ```
> flutter channel beta
Switching to flutter channel 'beta'...

Upgrading engine...
Flutter failed to run "bin\flutter --no-color --no-version-check precache". The flutter tool cannot access the
file or directory.
Please ensure that the SDK and/or project is installed in a location that has read/write permissions for the
current user.
```
4. Run `flutter doctor` or any flutter comman, output failed:
  ```
> flutter doctor
ResourceUnavailable: Program 'flutter.bat' failed to run: An error occurred trying to start process 'D:\dev\flutter\bin\flutter.bat' with working directory 'C:\Users\thats'. Access denied. At line:1 char:1
+ flutter doctor
+ ~~~~~~~~~~~~~~.
  ```

### Actual results

**All flutter command run failed after run `flutter channel xxx`.**

Reinstall flutter works for me, but it happens everytime after run `flutter channel xxx`.

Change owner of `D:\dev\flutter` does not work either.

### Flutter Doctor output

<details open>
<summary>Doctor output</summary>

```console
> flutter --verbose doctor
[✓] Flutter (Channel stable, 3.24.5, on Microsoft Windows [版本 10.0.22631.4460], locale zh-CN)
    • Flutter version 3.24.5 on channel stable at D:\dev\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • FLUTTER_GIT_URL = https://github.com/flutter/flutter.git
    • Framework revision dec2ee5c1f (2 weeks ago), 2024-11-13 11:13:06 -0800
    • Engine revision a18df97ca5
    • Dart version 3.5.4
    • DevTools version 2.37.3

[✓] Windows Version (Installed version of Windows is version 10 or higher)

[✗] Android toolchain - develop for Android devices
    ✗ ANDROID_HOME = C:\Users\thats\AppData\Local\Android\Sdk
      but Android SDK not found at this location.

[✓] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[✓] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.12.2)
    • Visual Studio at D:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.12.35521.163
    • Windows 10 SDK version 10.0.22621.0

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/to/windows-android-setup for detailed instructions).

[✓] IntelliJ IDEA Ultimate Edition (version 2024.3)
    • IntelliJ at D:\Program Files\JetBrains\Toolbox\app\IntelliJ IDEA Ultimate
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] Proxy Configuration
    • HTTP_PROXY is set
    • NO_PROXY is localhost,127.0.0.1,::1
    • NO_PROXY contains localhost
    • NO_PROXY contains ::1
    • NO_PROXY contains 127.0.0.1

[✓] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [版本 10.0.22631.4460]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 131.0.6778.86
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 131.0.2903.70

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 2 categories.
The Flutter CLI developer tool uses Google Analytics to report usage and diagnostic
data along with package dependencies, and crash reporting to send basic crash
reports. This data is used to help improve the Dart platform, Flutter framework,
and related tools.

Telemetry is not sent on the very first run. To disable reporting of telemetry,
run this terminal command:

    flutter --disable-analytics

If you opt out of telemetry, an opt-out event will be sent, and then no further
information will be sent. This data is collected in accordance with the Google
Privacy Policy (https://policies.google.com/privacy).
```

</details>