在PowerShell会话中,我可以使用C:、D:等更改文件系统驱动器:
PS: C:\> d:
PS: D:\> c:
PS: C:\>但是,在注册表驱动器(HKCU:)中尝试相同的操作不起作用:
PS: C:\> hkcu:
hkcu: : The term 'hkcu:' is not recognized as the name of a cmdlet, function, script file, or operable program. ....但是,我可以使用set-location (cd)改变驱动器:
PS: C:\> cd hkcu:
PS: HKCU:\>我对这种行为感到惊讶,我觉得这是不一致的,我想知道这是为什么,或幕后发生了什么。
发布于 2022-06-15 12:57:21
文件系统驱动器名(C:、D:等)显式地定义为函数;注册表“驱动器”(HKCU:等)都不是。通过以相同的方式为注册表“驱动器”定义函数,您可以启用相同的行为:
function HKCU: {
Set-Location $MyInvocation.MyCommand.Name
}https://stackoverflow.com/questions/72631713
复制相似问题