看板 Windows 關於我們 聯絡資訊
作業系統: Windows 10 Service Pack: 20H2 發生問題頻率: 100% 是否有做Windows Update: 有 問題內容: 據我所知Powershell中要表示 字元` = '``' = "````" 字元' = '''' = "`'" 字元[ = '`[' = "``[" 字元] = '`]' = "``]" 依此類推... # D:\`[test`]'` test-path 'D:\```[test```]''``' test-path "D:\``````[test``````]`'````" # E:\`[test`]'`` test-path 'E:\```[test```]''````' test-path "E:\``````[test``````]`'````````" 以上皆如預期回傳 True # D:\`[test`]'` test-path 'D:\```[test```]''`' test-path "D:\``````[test``````]`'``" # E:\`[test`]'`` test-path 'E:\```[test```]''```' test-path "E:\``````[test``````]`'``````" 上面這些怎麼也全都回傳 True? 單引號內右側少了1個` 雙引號內右側少了2個` 想了一下... 看起來'`'或"``"右側沒有跟其他特殊字元相鄰時等同'``'或"````" 所以test-path中 '`' = '``' = "````" = "``````" = "````````" 怎麼會有這麼奇怪的行為? 還是我哪裡誤會了? -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 27.52.102.237 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Windows/M.1603799596.A.AC5.html ※ 編輯: falcon (27.52.102.237 臺灣), 10/28/2020 01:27:57
Tabrith: 遇到引號建議使用 Test-Path -LiteralPath 11/13 03:08