I'm trying to load my aliases into a session by using the Import-Alias cmdlet using the command:
which has the following alias:
epp,"C:\Program Files\Just Great Software\EditPad Lite 7\EditPadLite7.exe","Launches Editpad Pro",None
If I run Get-Alias -Name epp I get:
CommandType Name ModuleName
———– —- ———-
Alias epp -> C:\Program Files\Just Great Software\Edi...
but if I run epp %profile I get:
PS T:\Scripts> epp $profile
epp : The term 'C:\Program Files\Just Great Software\EditPad Lite 7\EditPadLite7.exe' is not
recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling
of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ epp $profile
+ CategoryInfo : ObjectNotFound: (C:\Program File...ditPadLite7.exe:String) , Comma
+ FullyQualifiedErrorId : CommandNotFoundException
I think this is to do with my Alias.txt or my use of the Import-Alias cmdlet, but can't see where I'm going wrong.
First question – is the path to the file 'C:\Program Files\Just Great Software\EditPad Lite 7\EditPadLite7.exe' correct. Try running the file directly in PowerShell to test you have the correct path.
Second question – are you opening your PowerShell session with credentials that allow you to access the file?
Have you tried creating the alias using New-Alias rather than importing – to determine that your syntax is correct. If you can get the alias working that way then use Export-Alias to recreate your text file and try again.
Feel so stupid. The path was to EditPad Lite (which I'd deleted as I'd upgraded and deleted) and I'm using EditPad Pro (different path). Stupid, stupid, stupid – spent 2 hours wondering why this didn't work.