Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save AzimsTech/f1a22eb760929f6d8f7fd9e06e3c236a to your computer and use it in GitHub Desktop.

Select an option

Save AzimsTech/f1a22eb760929f6d8f7fd9e06e3c236a to your computer and use it in GitHub Desktop.
[GUIDE] Get Chocolatey PowerShell tab completion working

[GUIDE] Get Chocolatey Powershell Tab Completion Working

1. Open Windows Powershell

Win + XWindows Powershell (Admin)

2. Set Execution Policy

 Set-ExecutionPolicy RemoteSigned

3. Create Powershell Profile Script

notepad $profile

Copy & Paste :

# This script automatically filters the suspected candidates which are to be removed.

Get-ChildItem -Path "$env:ChocolateyInstall\lib" -Recurse -Filter "*.nupkg" | Where-Object {
  # Filter packages with version number
  $_.Name -match "^.*\.(\d+|\.){2,}\.nupkg"
} | Where-Object {
  # whose parent directory does not contain the same version number
  $_.Directory.BaseName -ne $_.BaseName
} | % {
  # Remove -WhatIf after having run this script and having double-checked (!) each file listed in the previous
  # run if it is really supposed to be removed (check the wiki link for information).
  Remove-Item $_.FullName -WhatIf
}

Ctrl + S to Save

4. Start Testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment