. (Join-Path $PSScriptRoot 'lab.ps1')
$version = $PSVersionTable.PSVersion
$edition = $PSVersionTable.PSEdition
Assert-Learning ($version.Major -ge 7 -and $edition -eq 'Core') 'actual modern host'
$path = (Get-Process -Id $PID).Path
Assert-Learning (Test-Path -LiteralPath $path -PathType Leaf) 'actual executable exists'
$external = & $path -NoProfile -NonInteractive -Command '$PSVersionTable.PSVersion.ToString()'
Assert-Learning ($LASTEXITCODE -eq 0 -and $external -eq $version.ToString()) 'separate interpreter verification'
Write-LearningReport 'powershell-install' @{version=$version.ToString();edition=$edition;separate_host_version=$external;software_install_and_uninstall_executed=$false;linux_macos_not_executed=$true}
本例需在 Windows / PowerShell7.6.5 / 同包自有文件、进程、回环JSON;其它平台和管理环境待验 中运行,请复制源码、保存文件或下载工程包后在本地执行验证。
运行说明与环境独立工程
运行环境:Windows / PowerShell7.6.5 / 同包自有文件、进程、回环JSON;其它平台和管理环境待验
入口文件:projects/powershell-lab/powershell-install.ps1
预期结果与验证条件观察提示
- 本机7.6.5/Core与独立子解释器一致,安装卸载不执行。
请结合实际环境逐项观察。
附件与关联工程包下载
课程关联工程包(登记关联16章) · 含当前章节或实例 · mbskycom202611a525.zip