nrfutil completion install powershell

When executing:

nrfutil completion install powershell

The output suggests adding this to $PROFILE

# From nrfutil completion install
# WARNING: nrfutil tab-completion may become slow because of Windows Defender
if ( Test-Path -Path ${USERPROFILE}\.nrfutil\share\nrfutil-completion\scripts\powershell\setup.ps1 ) {
    . ${USERPROFILE}\.nrfutil\share\nrfutil-completion\scripts\powershell\setup.ps1
}

I did some debuging to find out why the tab-completion does not work.
If I am not wrong the variable ${USERPROFILE} should be $env:USERPROFILE.
At least on my system (Windows 11, PowerShell 7.4) that was the solution.

Am I doing something wrong?

  • Hi,

    Where are nrfutil and .nrfutil located on your system, and where do you execute command "nrfutil completion install powershell" from?

    f I am not wrong the variable ${USERPROFILE} should be $env:USERPROFILE.
    At least on my system (Windows 11, PowerShell 7.4) that was the solution.

    Could you provide more details about your solution? 

    Best regards,
    Dejan

  • I am just opening a PowerShell Terminal.
    This opens in my $HOME directory, C:\Useres\myuser

    This also the location of .nrfutil
    I installed nrfutil with:

    winget install NordicSemiconductor.nrfutil
    
    Get-Command -Name nrfutil
    
    CommandType     Name                                               Version    Source
    -----------     ----                                               -------    ------
    Application     nrfutil.exe                                        0.0.0.0    C:\Users\timur\AppData\Local\Microsoft\WinGet\Packages\NordicSemiconductor.nrfutil_Microsoft.Winget.Source_8wekyb3d8bbwe\nrfutil.exe

    This is my $PROFILE where I had to add the $USERPROFILE manualy.

    # Set USERPROFILE
    $USERPROFILE = $env:USERPROFILE
    
    Invoke-Expression -Command $(gh completion -s powershell | Out-String)
    # Aliases
    Set-Alias -Name ll -Value Get-ChildItem -Force
    
    # Powershell Modules
    Import-Module posh-git
    
    Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete
    
    # WARNING: nrfutil tab-completion may become slow because of Windows Defender
    # From nrfutil completion install
    if ( Test-Path -Path ${USERPROFILE}\.nrfutil\share\nrfutil-completion\scripts\powershell\setup.ps1 ) {
        . ${USERPROFILE}\.nrfutil\share\nrfutil-completion\scripts\powershell\setup.ps1
     }
    else {
        Write-Host "⚠️ The nrfutil completion script does not exist."
        exit
    }

  • Hi,

    xigit said:
    This is my $PROFILE where I had to add the $USERPROFILE manualy.

    Where is the location of your $PROFILE?

    Could you show the places where you needed to add $USERPROFILE manually?

    Best regards,
    Dejan

  • echo $profile
    C:\Users\timur\OneDrive\Dokumente\PowerShell\Microsoft.PowerShell_profile.ps1

  • Hi,

    I edited my last reply.

    dejans said:
    Could you show the places where you needed to add $USERPROFILE manually?

    Best regards,
    Dejan

Related