我假设在一个函数中创建一个新的 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