我假设在一个函数中创建一个新的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
给你的PSDRIVE全局作用域:
New-PSDrive -Name qq -PSProvider filesystem -Root c:windows -Scope global