I would like to know how to do set-alias in PowerShell for the cmd used in developing Firefox extension:
cfx run -p C:\Users\username\AppData\Roaming\Mozilla\Firefox\Profiles\ripltbxm.cfxp
I've added the following to Microsoft.PowerShell_profile.ps1:
Set-Alias cfxp cfx run -p "C:\Users\username\AppData\Roaming\Mozilla\Firefox\Profiles\ripltbxm.cfxp"
But when PowerShell is launched, it shows the error:
Set-Alias : A positional parameter cannot be found that accepts argument 'run'.
At D:\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1:2 char:1
+ Set-Alias cfxp cfx run -p "C:\Users\username\AppData\Roaming\Mozilla\Firefox\Profil ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Set-Alias], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.SetAliasCommand
Also tried:
Set-Alias cfxp "cfx run -p C:\Users\username\AppData\Roaming\Mozilla\Firefox\Profiles\ripltbxm.cfxp"
with another error:
cfxp : The term 'cfx run -p C:\Users\username\AppData\Roaming\Mozilla\Firefox\Profiles\ripltbxm.cfxp' 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
+ cfxp
+ ~~~~
+ CategoryInfo : ObjectNotFound: (cfx run -p C:\U...s\ripltbxm.cfxp:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
In PowerShell aliases can be defined only for commands or cmdlets, not for entire commandlines with parameters:
You'll need a custom function if you want a shorthand for running a particular command with parameters.