.net 如何使在函数中创建的PSDrive可从此函数访问?
我假设在一个函数中创建一个新的PS驱动器使该驱动器只能在该函数中访问 如何使通过从主函数调用函数创建的PS驱动器可从该函数中访问.net 如何使在函数中创建的PSDrive可从此函数访问?,.net,powershell,.net,Powershell,我假设在一个函数中创建一个新的PS驱动器使该驱动器只能在该函数中访问 如何使通过从主函数调用函数创建的PS驱动器可从该函数中访问 $temproraryPSDriveName = "temproraryDrive" Create-PSDriveBy $temproraryPSDriveName #private function simply creates PSDrive based on a logic dir $($temproraryPSDriveName + ":") #Thi
$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
为您的PSDRIVE提供全局范围:
New-PSDrive -Name qq -PSProvider filesystem -Root c:\windows -Scope global