PowerShell 中文亂碼問題 (Big5 / Big-5 / UTF8 / UTF-8 / Bug5 / Bug-5)

 https://docs.microsoft.com/zh-tw/powershell/module/microsoft.powershell.core/about/about_character_encoding?view=powershell-7.1

$PSDefaultParameterValues['Out-File:Encoding'] = 'utf8'

$PSDefaultParameterValues['*:Encoding'] = 'utf8'

2021-09-09

Powershell 對於檔名有 [ 中括弧 ] 等保留字元的不適應症狀處理 Deal with filename contains reserved characters like [ ] in Powershell

Get-ChildItem 明明找得到 [ABC].txt,但用 Get-Item 卻找不到


雖然改用 [System.IO.File] 就能正確存取
且在 這邊 (微軟官方文件) 可以找到相關的 Method 來使用,但還是相當不方便
畢竟不是所有指令都能用 [System.IO.File] 來代替


2021-09-03

Silently Install UltraVNC 無訊息安裝

先安裝一次並加上 /saveinf 參數取得設定值參考檔
setup.exe /saveinf="C:\UVNCInstall.inf"

加上 /verysilent 及 /loadinf 來實現無訊息安裝
setup.exe /verysilent /loadinf="C:\silentinstall.inf"

Reference