Add Windows PowerShell fallback support when pwsh is unavailable #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The extension previously hardcoded the use of
pwsh(PowerShell 7+) as the PowerShell executable, which would fail in environments where only Windows PowerShell 5.1 (powershell.exe) is available. This is common in enterprise Windows environments where PowerShell 7+ hasn't been deployed yet.Changes Made
POWERSHELL_EXECUTABLE = 'pwsh'constantdetectPowerShellExecutable()method that:pwsh(PowerShell 7+)powershell(Windows PowerShell 5.1) ifpwshis unavailabletestExecutable()method with improved error messagesexecuteScript()andisPowerShellAvailable()methods to use the fallback logicExample Behavior
Before (fails on Windows without PowerShell 7+):
After (automatically falls back):
Testing
The extension now works seamlessly across different Windows PowerShell configurations without requiring users to install PowerShell 7+.
Fixes #6.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.