Skip to content

Latest commit

 

History

History
50 lines (29 loc) · 1.34 KB

File metadata and controls

50 lines (29 loc) · 1.34 KB

run a script

purpose

執行自己撰寫的腳本(script)。

preparation

  1. check ExecutionPolicy first (if your computer's OS is Windows...)

  2. write a script (自選)

    • 打開 Notepad,存成 test.ps1,內容如下:

      $numbers = 1, 3, 5
      
      foreach($item in $numbers)
      {
          Write-Host $item
      }
  3. run your script (檔名承上)

    • .\test.ps1: 因為剛好在該目錄底下,所以簡寫為 .

    • C:\Users\test.ps1: 列完整路徑也行。

  4. dala~

    1
    3
    5