Passing a variable to a powershell script via command line

前端 未结 5 1662
醉梦人生
醉梦人生 2020-12-08 00:27

I am new to powershell, and trying to teach myself the basics. I need to write a ps script to parse a file, which has not been too difficult.

Now I want to change i

5条回答
  •  攒了一身酷
    2020-12-08 00:36

    Make this in your test.ps1, at the first line

    param(
    [string]$a
    )
    
    Write-Host $a
    

    Then you can call it with

    ./Test.ps1 "Here is your text"
    

    Found here (English)

提交回复
热议问题