V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
ioiioi
V2EX  ›  问与答

请问如何在 powershell 命令中自动加上" | out-host -paging"

  •  
  •   ioiioi · Feb 27, 2015 · 2582 views
    This topic created in 4089 days ago, the information mentioned may be changed or developed.
    能实现linux的alias效果吗?

    比如说
    vim ~/.bashrc
    ...
    alias ls='ls $LS_OPTIONS -ah | more'
    ...
    3 replies    2016-12-12 15:51:26 +08:00
    ioiioi
        2
    ioiioi  
    OP
       Feb 27, 2015
    似乎无法实现,我想将out-host -paging替代成less
    set-alias less "out-host -paging"

    然后
    get-alias | less

    并不成功。

    错误是
    找不到参数名称与"-paging"匹配的参数。

    pS:我接触powershell不过两天。
    leohxj
        3
    leohxj  
       Dec 12, 2016
    使用函数定义,比如

    ```
    function cnpm {
    npm $args
    }
    ```
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3040 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 14:04 · PVG 22:04 · LAX 07:04 · JFK 10:04
    ♥ Do have faith in what you're doing.