Alias syntax for Firefox 'cfx run -profile '

前端 未结 1 1645
旧巷少年郎
旧巷少年郎 2020-12-22 11:00

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\\Mo         


        
相关标签:
1条回答
  • 2020-12-22 11:36

    In PowerShell aliases can be defined only for commands or cmdlets, not for entire commandlines with parameters:

    NAME
        New-Alias
    
    SYNOPSIS
        Creates a new alias.
    [...]
    DESCRIPTION
        The New-Alias cmdlet creates a new alias in the current Windows
        PowerShell session. Aliases created by using New-Alias are not
        saved after you exit the session or close Windows PowerShell. You
        can use the Export-Alias cmdlet to save your alias information to
        a file. You can later use Import-Alias to retrieve that saved
        alias information.
    
    PARAMETERS
    [...]
        -Value <String>
            Specifies the name of the cmdlet or command element that is
            being aliased.
    

    You'll need a custom function if you want a shorthand for running a particular command with parameters.

    function cfxp {
      & cfx run -p "$env:APPDATA\Mozilla\Firefox\Profiles\ripltbxm.cfxp"
    }
    
    0 讨论(0)
提交回复
热议问题