powershellnotepad++aliasnotepad

how can i do a alias in powershell to start notepad++


How can I do a alias in powershell to start notepad++ have Start notepad++ and have alias i wanna combinate that

set-alias -name notepad -value start notepad++ but i get this error

Set-Alias : A positional parameter cannot be found that accepts argument 'notepad++'. At line:1 char:1


Solution

  • Set-Alias doesn't accept commands like that. You can do 1 of 2 things:

    function Start-NotepadPlusPlus { 
        Start-Process 'notepad++.exe'
    } 
    Set-Alias -Name notepad -Value Start-NotepadPlusPlus
    
    Set-Alias -Name notepad -Value 'C:\Program Files (x86)\Notepad++\notepad++.exe'