5

我假设在一个函数中创建一个新的 PS-Drive 会使该驱动器只能在该函数中访问。

如何通过从 MAIN 调用该函数可访问的函数创建 PS-Drive?

 $temproraryPSDriveName = "temproraryDrive" 
 Create-PSDriveBy $temproraryPSDriveName #private function simply creates PSDrive based on a logic
 dir $($temproraryPSDriveName + ":") #This does not work as the 'teproraryDrive' is not 
                                     #accessible once I exit the Create-PSDriveBy function
4

1 回答 1

10

为您的 PSDRIVE 提供全局范围:

New-PSDrive -Name qq -PSProvider filesystem -Root c:\windows -Scope global
于 2013-05-21T08:21:03.280 回答