如何逃避星号?

问题描述 投票:2回答:1

当我尝试用路径HKCR:\*做任何事情时,它只需要永远。所以我假设它采用星号作为通配符。

Test-Path -Path HKCR:\*

我试过的

HKCR:\\*
HKCR:\`*
'HKCR:\*'
powershell
1个回答
2
投票

使用LiteralPath参数而不是Path参数来防止字符被解释为通配符。

Test-Path -LiteralPath HKCR:\*
© www.soinside.com 2019 - 2024. All rights reserved.