Skip to content

Latest commit

 

History

History
41 lines (28 loc) · 1.07 KB

File metadata and controls

41 lines (28 loc) · 1.07 KB

get the content of a text file

purpose

讀取內含中文的文字檔:chores_list.txt

```
整理雜物 100
洗衣服 100
清地板 100
倒垃圾 100
刷馬桶 100
洗洗手槽 100
換除濕劑 100
清冷氣濾網 100
清電風扇 100
洗濾水壺 100
```

solution

  1. (這個括號內的文字都是廢話。如果這行不寫點什麼,下面 powershell code preview 就無法正常顯示。)

    [System.IO.File]::ReadAllLines(".\chores_list.txt", [System.Text.Encoding]::UTF8)
  2. (這個括號內的文字都是廢話。同上。)

    Get-Content -Path .\chores_list.txt -Encoding UTF8

FYI