2

I know you can write support for custom PSDrives. But those are always a root of a file system. What would be nice if there was a way to allow for VFS start at arbitrary nodes of the file system, such as using Set-Location to enter archive file maybe and use them as if they were folders. (Kinda like Far does this).

Is there any way to achieve this? I know, it would be some work to get it right and working, but at the moment I am more interested whether it would be possible at all.

ETA: What I don't want is a new PSDrive for every archive I enter, so the following isn't actually what I'm after:

PS C:\Path> Invoke-Magic stuff.zip
PS C:\Path> Set-Location MyNewDrive:
PS MyNewDrive:> _

but rather

PS C:\Path> Set-Location stuff.zip
PS C:\Path\stuff.zip> _
4

3 回答 3

3

您所描述的是一个文件系统提供程序,它也将档案视为容器对象。由于FileSystemProvider是密封的,我认为您必须编写自己的NavigationCmdletProvider来发挥您的魔力。

于 2009-07-22T14:40:08.023 回答
1

您需要编写一个提供程序这里是 SourceSafe 提供程序的一个示例(旧但仍然相关)

于 2009-07-22T14:31:37.290 回答
0

当然。事实上,您已经可以在某种程度上做到这一点,而无需编写任何管理单元代码。例如:

New-PsDrive -Scope Global -Name MyMod -PSProvider FileSystem -Root (split-path $profile | join-path -child Modules)
dir MyMod:\
于 2009-07-22T14:14:44.273 回答