PowerShell: "The variable '$elapsed' cannot be retrieved because it has not been set."
- Vorherrschende Sprache
- PowerShell
- Sterne
- 273
- Forks
- 117
- Ø Merge
- 1 Std.
- Gemergte PRs (30 T.)
- 2
Beschreibung
When I now log in to Azure Cloud Shell using PowerShell I get this error:
```
InvalidOperation: /opt/microsoft/powershell/7/profile.ps1:268
Line |
268 | if($elapsed -gt '1000')
| ~~~~~~~~
| The variable '$elapsed' cannot be retrieved because it has not been set.
```
here's what is happening:

The profile file `/opt/microsoft/powershell/7/profile.ps1` is part of the Azure Cloud Shell.
I have `Set-StrictMode -Version latest` in my PowerShell profile. If I remove this the error goes away.
I think the default for Azure Cloud Shell PowerShell should use strict mode to catch unnecessary issues.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.