# replace the command name with any PowerShell command name # you'd like to explore $Name = "Get-Printer" $ModuleName = (Get-Command-Name$Name-CommandType Function, Cmdlet).Source
if (''-eq$ModuleName) { Write-Warning"$Name was defined in memory, no module available." return }
Write-Warning"$Name resides in $ModuleName module"
$module = Get-Module-Name$ModuleName-ListAvailable explorer $module.ModuleBase
只需要将 $name 改为您希望探索的任何 PowerShell cmdlet 名称即可。如果该命令存在于一个 PowerShell 模块中,该模块将打开一个 Windows 资源管理器,您可以在其中检查它的内容。
# change $Path to a ZIP file that exists on your system! $Path = "$Home\Desktop\Test.zip"
# change extension filter to a file extension that exists # inside your ZIP file $Filter = '*.wav'
# change output path to a folder where you want the extracted # files to appear $OutPath = 'C:\ZIPFiles'
# ensure the output folder exists $exists = Test-Path-Path$OutPath if ($exists-eq$false) { $null = New-Item-Path$OutPath-ItemType Directory -Force }
# load ZIP methods Add-Type-AssemblyName System.IO.Compression.FileSystem
# open ZIP archive for reading $zip = [System.IO.Compression.ZipFile]::OpenRead($Path)
# find all files in ZIP that match the filter (i.e. file extension) $zip.Entries | Where-Object { $_.FullName -like$Filter } | ForEach-Object { # extract the selected items from the ZIP archive # and copy them to the out folder $FileName = $_.Name [System.IO.Compression.ZipFileExtensions]::ExtractToFile($_, "$OutPath\$FileName", $true) }