How to enable command completion for the AWS CLI on Windows within the PowerShell
This article has not been completed yet. However, it may already contain helpful information and therefore it has been published at this stage.
Introduction:
To create a new "All users, All Hosts" profile, type:
if (!(Test-Path -Path $PROFILE.AllUsersAllHosts))
{ New-Item -Type File -Path $PROFILE.AllUsersAllHosts -Force }
Notepad C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1
Register-ArgumentCompleter -Native -CommandName aws -ScriptBlock {
param($commandName, $wordToComplete, $cursorPosition)
$env:COMP_LINE=$wordToComplete
$env:COMP_POINT=$cursorPosition
aws_completer.exe | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
Remove-Item Env:\COMP_LINE
Remove-Item Env:\COMP_POINT
}
Set-ExecutionPolicy RemoteSigned
# Will run any script on the local machine, that has not come from the internet
Set-ExecutionPolicy Unrestricted
# Will allow any script to run, although if you downloaded it from the internet it will ask you to confirm you want to run it.
Unblock-File C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1
# Will unblock the execution of this particular file
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
# Will run any script on the local machine, that has not come from the internet for a specific User
Conlusio:
Sources: