Set-PSDebug 帮助信息

本文介绍如何使用Set-PSDebug cmdlet控制PowerShell脚本的调试模式,包括启动与停止调试、设置跟踪级别及启用严格模式等。通过具体示例展示了如何在不同场景下运用这些调试选项。
如下说明是翻译: help Set-PSDebug 产生的帮助信息.
译者: Edengundam(马涛)
 
Set-PSDebug
 
大纲
控制脚本调试模式的启动与停止, 设置跟踪级别, 进入严格(strict)模式.
 
语法
Set-PSDebug [-trace <int>] [-step] [-strict] [<CommonParameters>]
 
Set-PSDebug [-off] [<CommonParameters>]
 
详细描述
控制脚本调试模式的启动与停止, 设置跟踪级别, 进入严格(strict)模式. cmdlet允许你控制Windows PowerShell解释器的调试选项. 当参数Trace设置为1, 只有脚本被执行的行被跟踪.(译者注:这里的脚本包括在命令行的输入. ) 当参数设置为2, 变量赋值, 函数和脚本调用也将会被跟踪.
 
如果指定了参数Step, 用户将会在执行脚本每一行之前, 看到和参数Confirm一样的选项菜单.
 
在单步模式中, 选项菜单不同选项的响应行为如下所述:
 
·         "Yes"执行当前行
·         "Yes to All" 退出单步模式(脚本将会继续执行而不再提示任何信息)
·         "No""No To All" 退出脚本
·         "Suspend"启动一个嵌套shell, 当从前套shell退出将会重新显示选项菜单.
 
参数
 
-trace <int>
指定跟踪级别:
 
·         0 - 关闭脚本跟踪
·         1 - 对执行的脚本行进行跟踪
·         2 - 对执行的脚本行, 变量赋值, 函数和脚本调用进行跟踪.
 
强制参数?
False
参数位置?
Named
默认值
1
允许从管道绑定输入?
False
允许通配符扩展?
False
 
-step <SwitchParameter>
打开脚本单步模式. 在每行运行之前, 用户被提示, 以允许停止, 继续或进入新的解释器环境检查脚本的运行状态操作.
 
指定Step, 将会把参数Trace设置为1.
 
强制参数?
False
参数位置?
Named
默认值
False
允许从管道绑定输入?
False
允许通配符扩展?
False
 
-off <SwitchParameter>
关闭所有脚本调试机制.
 
强制参数?
false
参数位置?
named
默认值
False
允许从管道绑定输入?
false
允许通配符扩展?
false
 
-strict <SwitchParameter>
指示如果变量在赋值前没有赋值, 解释器抛出异常.
 
强制参数?
false
参数位置?
named
默认值
False
允许从管道绑定输入?
false
允许通配符扩展?
false
 
<公共参数>
此命令支持公共参数: -Verbose, -Debug, -ErrorAction, -ErrorVariable, and -OutVariable. 更多信息, 输入, "get-help about_commonparameters".
 
注意
 
更多信息, 输入"Get-Help Set-PsDebug  -detailed".需要技术信息, 输入"Get-Help Set-PsDebug -full".
 
如果需要为该命令提供多个参数, 请使用逗号进行分隔. 例如, "<parameter-name> <value1>, <value2>".
 
1
 
C:/PS>set-psdebug -trace 2; foreach ($i in 1..3) {$i}
 
此命令将跟踪级别设置为2, 然后执行脚本显示数字1, 23.
 
DEBUG:1+ Set-PsDebug -trace 2; foreach ($i in 1..3) {$i}
DEBUG:1+ Set-PsDebug -trace 2; foreach ($i in 1..3) {$i}
1
DEBUG:1+ Set-PsDebug -trace 2; foreach ($i in 1..3) {$i}
2
DEBUG:1+ Set-PsDebug -trace 2; foreach ($i in 1..3) {$i}
3
 
2
 
C:/PS>set-psdebug -step; foreach ($i in 1..3) {$i}
 
此命令打开单步模式, 然后执行脚本显示数字1, 23.
 
DEBUG:1+ Set-PsDebug -step; foreach ($i in 1..3) {$i}
Continue with this operation?
   1+ Set-PsDebug -step; foreach ($i in 1..3) {$i}
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help
(default is "Y"):a
DEBUG:1+ Set-PsDebug -step; foreach ($i in 1..3) {$i}
1
2
3
 
3
 
C:/PS>set-psdebug -off; foreach ($i in 1..3) {$i}
 
此命令关闭所有调试信息, , 然后执行脚本显示数字1, 23.
 
1
2
3
 
4
 
C:/PS>set-psdebug -strict; $NewVar
 
此命令指示解释器进入严格模式, 然后试图访问未赋值变量.
 
变量$NewVar由于没有赋值因此无法访问.
 
At line:1 char:28
+ Set-PsDebug -strict;$NewVar <<<<
 
相关链接
Write-Debug 
 
那你继续加油吧 你看看我是选Y还是关掉窗口重新开始 还是怎么办?PS C:\Users\Administrator> function Set-CurlVersion { >> [CmdletBinding()] >> param( >> [Parameter(Mandatory=$true)] >> [ValidateSet("custom", "system")] >> [string]$Version >> ) >> >> $platform = Get-Platform >> $currentPath = $env:Path -split [System.IO.Path]::PathSeparator >> >> # 创建系统路径变量 >> $systemPath = if ($platform -eq "Windows") { >> Join-Path -Path $env:SystemRoot -ChildPath "System32" >> } else { >> $null >> } >> >> switch ($Version) { >> "custom" { >> # 添加自定义路径到临时环境变量 >> $newPath = @($script:CurlPath) >> $newPath += $currentPath | Where-Object { >> $_ -ne $systemPath -and >> $_ -ne "/usr/bin" -and >> $_ -ne "/usr/local/bin" >> } >> } >> "system" { >> # 恢复原始环境变量 >> $newPath = $currentPath | Where-Object { $_ -ne $script:CurlPath } >> } >> } >> >> # 更新环境变量 >> $env:Path = $newPath -join [System.IO.Path]::PathSeparator >> Write-Host "已切换到 curl $Version 版本" -ForegroundColor Green >> } >> PS C:\Users\Administrator> # 创建模块目录 >> $moduleDir = "$env:USERPROFILE\Documents\WindowsPowerShell\Modules\CurlTools" >> New-Item -ItemType Directory -Path $moduleDir -Force | Out-Null >> >> # 创建模块文件 >> $modulePath = Join-Path $moduleDir "CurlTools.psm1" >> PS C:\Users\Administrator> $manifestContent = @' >> @{ >> ModuleVersion = '1.0.0' >> RootModule = 'CurlTools.psm1' >> Author = 'Your Name' >> Description = '高级curl工具集模块' >> FunctionsToExport = @( >> 'Get-CurlVersion', >> 'Set-CurlVersion', >> 'Invoke-SecureDownload', >> 'Get-FileHashFromUrl', >> 'Update-CurlToolsModule' >> ) >> CompatiblePSEditions = @('Desktop', 'Core') >> PowerShellVersion = '5.1' >> } >> '@ >> >> Set-Content -Path (Join-Path $moduleDir "CurlTools.psd1") -Value $manifestContent >> PS C:\Users\Administrator> # 完整的模块内容(已修复所有错误) >> $moduleContent = @' >> # CurlTools.psm1 >> # ============== >> # 模块主文件 >> >> # 初始化模块变量 >> $script:Config = $null >> $script:CurlPath = $null >> $script:ConfigDir = $null >> $script:ConfigPath = $null >> >> # 检测操作系统 >> function Get-Platform { >> if ($PSVersionTable.PSEdition -eq "Core") { >> if ($IsWindows) { return "Windows" } >> elseif ($IsLinux) { return "Linux" } >> elseif ($IsMacOS) { return "macOS" } >> } else { >> return "Windows" >> } >> } >> >> # 获取跨平台配置目录 >> function Get-ConfigDir { >> $platform = Get-Platform >> switch ($platform) { >> "Linux" { >> if (-not (Test-Path "$env:HOME/.config")) { >> New-Item -ItemType Directory -Path "$env:HOME/.config" -Force | Out-Null >> } >> return "$env:HOME/.config/curltools" >> } >> "macOS" { >> if (-not (Test-Path "$env:HOME/Library/Application Support")) { >> New-Item -ItemType Directory -Path "$env:HOME/Library/Application Support" -Force | Out-Null >> } >> return "$env:HOME/Library/Application Support/CurlTools" >> } >> default { >> if (-not (Test-Path $env:APPDATA)) { >> New-Item -ItemType Directory -Path $env:APPDATA -Force | Out-Null >> } >> return "$env:APPDATA\CurlTools" >> } >> } >> } >> >> # 获取跨平台curl路径 >> function Get-DefaultCurlPath { >> $platform = Get-Platform >> switch ($platform) { >> "Linux" { return "/usr/bin" } >> "macOS" { return "/usr/local/bin" } >> default { >> # 尝试自动检测Windows上的curl路径 >> $potentialPaths = @( >> "C:\Program Files\curl\bin", >> "C:\curl\bin", >> "$env:USERPROFILE\curl\bin", >> "E:\curl-8.15.0_4-win64-mingw\bin" >> ) >> >> foreach ($path in $potentialPaths) { >> $curlExe = Join-Path $path "curl.exe" >> if (Test-Path $curlExe -PathType Leaf) { >> return $path >> } >> } >> >> # 使用默认路径 >> return "E:\curl-8.15.0_4-win64-mingw\bin" >> } >> } >> } >> >> # 初始化模块配置 >> function Initialize-ModuleConfig { >> $script:ConfigDir = Get-ConfigDir >> >> # 确保配置目录存在 >> if (-not (Test-Path $script:ConfigDir)) { >> New-Item -ItemType Directory -Path $script:ConfigDir -Force | Out-Null >> } >> >> $script:ConfigPath = Join-Path -Path $script:ConfigDir -ChildPath "config.json" >> >> # 加载或创建默认配置 >> if (Test-Path $script:ConfigPath) { >> try { >> $script:Config = Get-Content $script:ConfigPath | ConvertFrom-Json >> } catch { >> Write-Warning "配置加载失败: $_,创建新配置" >> $script:Config = $null >> } >> } >> >> if (-not $script:Config) { >> $script:Config = [PSCustomObject]@{ >> CurlPath = Get-DefaultCurlPath >> LastUpdate = (Get-Date).ToString("o") >> AutoUpdate = $true >> } >> $script:Config | ConvertTo-Json | Set-Content $script:ConfigPath -Force >> } >> >> # 设置模块路径 >> $script:CurlPath = $script:Config.CurlPath >> } >> >> # 保存配置 >> function Save-ModuleConfig { >> $script:Config | ConvertTo-Json | Set-Content $script:ConfigPath -Force >> } >> >> # 在模块导入时自动初始化配置 >> Initialize-ModuleConfig >> >> # 获取文件哈希 >> function Get-FileHashFromUrl { >> <# >> .SYNOPSIS >> 从URL获取文件的哈希值 >> >> .DESCRIPTION >> 下载文件到临时位置并计算其哈希值 >> >> .PARAMETER Url >> 要下载的文件URL >> >> .PARAMETER Algorithm >> 哈希算法 (SHA256, SHA1, MD5等) >> >> .EXAMPLE >> Get-FileHashFromUrl -Url "https://example.com/file.zip" -Algorithm SHA256 >> #> >> param( >> [Parameter(Mandatory=$true)] >> [string]$Url, >> >> [ValidateSet("SHA1", "SHA256", "SHA384", "SHA512", "MD5")] >> [string]$Algorithm = "SHA256" >> ) >> >> $tempFile = [System.IO.Path]::GetTempFileName() >> try { >> Write-Verbose "下载文件以计算哈希: $Url" >> $curlPath = Join-Path $script:CurlPath "curl.exe" >> & $curlPath -L -s -o $tempFile $Url >> >> if (-not (Test-Path $tempFile -PathType Leaf)) { >> throw "文件下载失败" >> } >> >> $hash = (Get-FileHash -Path $tempFile -Algorithm $Algorithm).Hash >> Write-Verbose "$Algorithm 哈希值: $hash" >> return $hash >> } catch { >> Write-Error "获取文件哈希失败: $_" >> return $null >> } finally { >> Remove-Item $tempFile -Force -ErrorAction SilentlyContinue >> } >> } >> >> # 获取curl版本信息 >> function Get-CurlVersion { >> <# >> .SYNOPSIS >> 获取已安装和最新的curl版本信息 >> >> .DESCRIPTION >> 返回包含已安装版本、最新版本和更新命令的对象 >> >> .EXAMPLE >> Get-CurlVersion >> #> >> # 获取已安装版本 >> try { >> $curlPath = Join-Path $script:CurlPath "curl.exe" >> $versionOutput = & $curlPath --version 2>&1 | Out-String >> if (-not ($versionOutput -match 'curl (\d+\.\d+\.\d+)')) { >> throw "无法解析 curl 版本信息" >> } >> $installedVersion = $Matches[1] >> } catch { >> Write-Warning "获取已安装版本失败: $_" >> $installedVersion = "0.0.0" >> } >> >> # 获取最新版本 >> try { >> $latestVersion = $null >> >> # 方案1: 使用官方下载页面解析 >> try { >> $curlPath = Join-Path $script:CurlPath "curl.exe" >> $releasePage = & $curlPath -s -L https://curl.se/download.html >> if ($releasePage -match 'curl (\d+\.\d+\.\d+)</a> is the latest') { >> $latestVersion = $Matches[1] >> } >> } catch { >> Write-Verbose "官方下载页面解析失败: $_" >> } >> >> # 方案2: 使用 GitHub API >> if (-not $latestVersion) { >> try { >> $headers = @{ >> "User-Agent" = "PowerShell-CurlTools" >> "Accept" = "application/vnd.github.v3+json" >> } >> $curlPath = Join-Path $script:CurlPath "curl.exe" >> $releaseInfo = & $curlPath -s -L -H $headers https://api.github.com/repos/curl/curl/releases/latest >> $json = $releaseInfo | ConvertFrom-Json >> $latestVersion = $json.tag_name -replace 'curl-', '' -replace '_', '.' >> } catch { >> Write-Verbose "GitHub API 请求失败: $_" >> } >> } >> >> # 方案3: 从curl.haxx.se获取版本 >> if (-not $latestVersion) { >> try { >> $curlPath = Join-PPath $script:CurlPath "curl.exe" >> $versionPage = & $curlPath -s -L https://curl.haxx.se/info >> if ($versionPage -match 'curl (\d+\.\d+\.\d+)') { >> $latestVersion = $Matches[1] >> } >> } catch { >> Write-Verbose "curl.haxx.se 请求失败: $_" >> } >> } >> >> if (-not $latestVersion) { >> throw "无法获取最新版本" >> } >> } catch { >> Write-Warning "获取最新版本失败: $_" >> $latestVersion = $installedVersion >> } >> >> return [PSCustomObject]@{ >> Installed = $installedVersion >> Latest = $latestVersion >> UpdateCmd = "winget install curl.curl" >> } >> } >> >> # 切换curl版本 >> function Set-CurlVersion { >> <# >> .SYNOPSIS >> 切换使用的curl版本 >> >> .DESCRIPTION >> 在自定义版本和系统版本之间切换 >> >> .PARAMETER Version >> 要切换的版本 (custom 或 system) >> >> .EXAMPLE >> Set-CurlVersion -Version custom >> #> >> [CmdletBinding()] >> param( >> [Parameter(Mandatory=$true)] >> [ValidateSet("custom", "system")] >> [string]$Version >> ) >> >> $platform = Get-Platform >> $currentPath = $env:Path -split [System.IO.Path]::PathSeparator >> >> # 创建系统路径变量 >> $systemPath = if ($platform -eq "Windows") { >> Join-Path -Path $env:SystemRoot -ChildPath "System32" >> } else { >> $null >> } >> >> switch ($Version) { >> "custom" { >> # 添加自定义路径到临时环境变量 >> $newPath = @($script:CurlPath) >> $newPath += $currentPath | Where-Object { >> $_ -ne $systemPath -and >> $_ -ne "/usr/bin" -and >> $_ -ne "/usr/local/bin" >> } >> } >> "system" { >> # 恢复原始环境变量 >> $newPath = $currentPath | Where-Object { $_ -ne $script:CurlPath } >> } >> } >> >> # 更新环境变量 >> $env:Path = $newPath -join [System.IO.Path]::PathSeparator >> Write-Host "已切换到 curl $Version 版本" -ForegroundColor Green >> } >> >> # 安全下载文件 >> function Invoke-SecureDownload { >> <# >> .SYNOPSIS >> 安全下载文件并验证哈希值 >> >> .DESCRIPTION >> 下载文件并验证其哈希值以确保完整性 >> >> .PARAMETER Url >> 要下载的文件URL >> >> .PARAMETER ExpectedHash >> 期望的哈希值(可选) >> >> .PARAMETER Algorithm >> 哈希算法 (默认: SHA256) >> >> .PARAMETER OutputPath >> 输出文件路径 >> >> .PARAMETER AutoVerify >> 自动从源获取哈希值 >> >> .EXAMPLE >> Invoke-SecureDownload -Url "https://example.com/file.zip" -AutoVerify >> #> >> [CmdletBinding()] >> param( >> [Parameter(Mandatory=$true)] >> [string]$Url, >> >> [string]$ExpectedHash, >> >> [ValidateSet("SHA1", "SHA256", "SHA384", "SHA512", "MD5")] >> [string]$Algorithm = "SHA256", >> >> [string]$OutputPath = (Split-Path -Leaf $Url), >> >> [switch]$AutoVerify >> ) >> >> try { >> # 创建下载目录 >> $downloadDir = Split-Path -Path $OutputPath -Parent >> if (-not [string]::IsNullOrEmpty($downloadDir) -and -not (Test-Path $downloadDir)) { >> New-Item -ItemType Directory -Path $downloadDir -Force | Out-Null >> } >> >> # 下载文件 >> Write-Host "下载文件: $Url" -ForegroundColor Cyan >> $curlPath = Join-Path $script:CurlPath "curl.exe" >> & $curlPath -L -o $OutputPath -C - $Url >> >> # 自动获取哈希值(如果需要) >> if ($AutoVerify -or (-not $ExpectedHash)) { >> $ExpectedHash = Get-FileHashFromUrl -Url $Url -Algorithm $Algorithm >> if (-not $ExpectedHash) { >> throw "无法获取远程文件的$Algorithm哈希值" >> } >> Write-Host "自动获取哈希值: $ExpectedHash" -ForegroundColor Yellow >> } >> >> # 验证哈希 >> $actualHash = (Get-FileHash -Path $OutputPath -Algorithm $Algorithm).Hash >> >> if ($actualHash -ne $ExpectedHash) { >> Remove-Item $OutputPath -Force >> throw "文件哈希验证失败! 期望: $ExpectedHash, 实际: $actualHash" >> } >> >> Write-Host "✅ 文件验证成功: $OutputPath" -ForegroundColor Green >> return $OutputPath >> } catch { >> Write-Error "下载失败: $_" >> return $null >> } >> } >> >> # 模块更新函数 >> function Update-CurlToolsModule { >> <# >> .SYNOPSIS >> 更新CurlTools模块到最新版本 >> >> .DESCRIPTION >> 从GitHub仓库下载最新版本的模块文件 >> >> .EXAMPLE >> Update-CurlToolsModule >> #> >> try { >> $updateUrl = "https://raw.githubusercontent.com/yourname/curltools/main/CurlTools.psm1" >> >> # 获取模块路径 >> $moduleDir = if ($PSVersionTable.PSEdition -eq "Core") { >> "$env:USERPROFILE\Documents\PowerShell\Modules\CurlTools" >> } else { >> "$env:USERPROFILE\Documents\WindowsPowerShell\Modules\CurlTools" >> } >> >> $modulePath = Join-Path -Path $moduleDir -ChildPath "CurlTools.psm1" >> >> # 创建备份 >> $backupPath = "$modulePath.bak" >> if (Test-Path $modulePath) { >> Copy-Item -Path $modulePath -Destination $backupPath -Force >> } >> >> # 下载更新 >> Write-Host "下载模块更新..." -ForegroundColor Cyan >> $curlPath = Join-Path $script:CurlPath "curl.exe" >> & $curlPath -L -o $modulePath $updateUrl >> >> # 重新加载模块 >> Remove-Module CurlTools -ErrorAction SilentlyContinue >> Import-Module $modulePath -Force >> >> # 更新配置 >> $script:Config.LastUpdate = (Get-Date).ToString("o") >> Save-ModuleConfig >> >> Write-Host "✅ 模块已成功更新至最新版本" -ForegroundColor Green >> return $true >> } catch { >> # 恢复备份 >> if (Test-Path $backupPath) { >> Copy-Item -Path $backupPath -Destination $modulePath -Force >> Remove-Item $backupPath -Force >> } >> >> Write-Error "模块更新失败: $_" >> return $false >> } >> } >> >> # 导出模块成员 >> Export-ModuleMember -Function Get-CurlVersion, Set-CurlVersion, Invoke-SecureDownload, Get-FileHashFromUrl, Update-CurlToolsModule >> '@ >> >> Set-Content -Path $modulePath -Value $moduleContent -Force >> PS C:\Users\Administrator> # 创建模块目录 >> $moduleDir = "$env:USERPROFILE\Documents\WindowsPowerShell\Modules\CurlTools" >> New-Item -ItemType Directory -Path $moduleDir -Force >> >> # 创建模块清单 >> $manifestContent = @" >> @{ >> ModuleVersion = '1.0.0' >> RootModule = 'CurlTools.psm1' >> Author = 'Your Name' >> Description = '高级curl工具集模块' >> FunctionsToExport = @( >> 'Get-CurlVersion', >> 'Set-CurlVersion', >> 'Invoke-SecureDownload', >> 'Get-FileHashFromUrl', >> 'Update-CurlToolsModule' >> ) >> CompatiblePSEditions = @('Desktop', 'Core') >> PowerShellVersion = '5.1' >> } >> "@ >> Set-Content -Path "$moduleDir\CurlTools.psd1" -Value $manifestContent >> >> # 创建模块文件 >> $modulePath = "$moduleDir\CurlTools.psm1" >> # 使用上面完整的模块内容填充此文件 >> 目录: C:\Users\Administrator\Documents\WindowsPowerShell\Modules Mode LastWriteTime Length Name ---- ------------- ------ ---- d----- 2025/8/12 19:05 CurlTools PS C:\Users\Administrator> # 导入模块 >> Import-Module CurlTools -Force >> >> # 获取curl版本信息 >> $versionInfo = Get-CurlVersion >> Write-Host "当前版本: $($versionInfo.Installed)" >> Write-Host "最新版本: $($versionInfo.Latest)" >> >> # 安全下载文件(自动验证哈希) >> $downloadedFile = Invoke-SecureDownload -Url "https://example.com/file.zip" -AutoVerify >> >> # 切换curl版本 >> Set-CurlVersion -Version custom >> >> # 更新模块 >> Update-CurlToolsModule >> 警告: 获取已安装版本失败: 无法将参数绑定到参数“Path”,因为该参数是空值。 警告: 获取最新版本失败: 无法获取最新版本 当前版本: 0.0.0 最新版本: 0.0.0 下载文件: https://example.com/file.zip Invoke-SecureDownload : 下载失败: 无法将参数绑定到参数“Path”,因为该参数是空值。 所在位置 行:10 字符: 19 + ... oadedFile = Invoke-SecureDownload -Url "https://example.com/file.zip" ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Invoke-SecureDownload 已切换到 curl custom 版本 下载模块更新... Update-CurlToolsModule : 模块更新失败: 无法将参数绑定到参数“Path”,因为该参数是空值。 所在位置 行:16 字符: 1 + Update-CurlToolsModule + ~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Update-CurlToolsModule False PS C:\Users\Administrator> # 检查模块是否加载 >> Get-Module -Name CurlTools >> >> # 查看导出的函数 >> (Get-Module CurlTools).ExportedCommands.Keys >> >> # 查看模块路径 >> (Get-Module CurlTools).Path >> ModuleType Version Name ExportedCommands ---------- ------- ---- ---------------- Script 1.0.0 CurlTools {Get-CurlVersion, Get-FileHashFromUrl, Invoke-SecureDownlo... Get-CurlVersion Get-FileHashFromUrl Invoke-SecureDownload Set-CurlVersion Update-CurlToolsModule C:\Users\Administrator\Documents\WindowsPowerShell\Modules\CurlTools\CurlTools.psm1 PS C:\Users\Administrator> # 设置调试模式 >> Set-PSDebug -Trace 2 >> >> # 运行函数 >> Get-CurlVersion >> >> # 关闭调试 >> Set-PSDebug -Off >> 调试: 5+ >>>> Get-CurlVersion 调试: 165+ function Get-CurlVersion >>>> { 调试: ! CALL function 'Get-CurlVersion' (defined in file 'C:\Users\Administrator\Documents\WindowsPowerShell\Modules\CurlTools\CurlTools.psm1') 调试: 178+ >>>> $curlPath = Join-Path $script:CurlPath "curl.exe" 调试: 185+ >>>> Write-Warning "获取已安装版本失败: $_" 警告: 获取已安装版本失败: 无法将参数绑定到参数“Path”,因为该参数是空值。 调试: 186+ >>>> $installedVersion = "0.0.0" 调试: ! SET $installedVersion = '0.0.0'. 调试: 191+ >>>> $latestVersion = $null 调试: ! SET $latestVersion = ''. 调试: 195+ >>>> $curlPath = Join-Path $script:CurlPath "curl.exe" 调试: 201+ >>>> Write-Verbose "官方下载页面解析失败: $_" 调试: 205+ if ( >>>> -not $latestVersion) { 调试: 207+ >>>> $headers = @{ 调试: ! SET $headers = 'System.Collections.Hashtable'. 调试: 211+ >>>> $curlPath = Join-Path $script:CurlPath "curl.exe" 调试: 216+ >>>> Write-Verbose "GitHub API 请求失败: $_" 调试: 221+ if ( >>>> -not $latestVersion) { 调试: 223+ >>>> $curlPath = Join-PPath $script:CurlPath "curl.exe" 调试: 229+ >>>> Write-Verbose "curl.haxx.se 请求失败: $_" 调试: 233+ if ( >>>> -not $latestVersion) { 调试: 234+ >>>> throw "无法获取最新版本" 调试: 237+ >>>> Write-Warning "获取最新版本失败: $_" 警告: 获取最新版本失败: 无法获取最新版本 调试: 238+ >>>> $latestVersion = $installedVersion 调试: ! SET $latestVersion = '0.0.0'. 调试: 241+ return >>>> [PSCustomObject]@{ 调试: 246+ >>>> } 调试: 8+ >>>> Set-PSDebug -Off Installed Latest UpdateCmd --------- ------ --------- 0.0.0 0.0.0 winget install curl.curl PS C:\Users\Administrator> # 在函数开头添加错误处理 >> function Get-CurlVersion { >> [CmdletBinding()] >> param() >> >> try { >> # 函数主体 >> } >> catch { >> Write-Error "Get-CurlVersion 失败: $_" >> Write-Error "详细信息: $($_.ScriptStackTrace)" >> return $null >> } >> } >> PS C:\Users\Administrator> # 创建自签名证书 >> $cert = New-SelfSignedCertificate -Type CodeSigning -Subject "CN=CurlTools" -KeyUsage DigitalSignature >> >> # 签名模块 >> Set-AuthenticodeSignature -FilePath $modulePath -Certificate $cert >> 目录: C:\Users\Administrator\Documents\WindowsPowerShell\Modules\CurlTools SignerCertificate Status Path ----------------- ------ ---- 96719E43A5BBD9F7A6394A6FE0A4686AEF7667FC UnknownError CurlTools.psm1 PS C:\Users\Administrator> # Tests/Get-CurlVersion.Tests.ps1 >> Describe "Get-CurlVersion" { >> It "返回有效的版本对象" { >> $result = Get-CurlVersion >> $result | Should -Not -Be $null >> $result.Installed | Should -Match '^\d+\.\d+\.\d+$' >> $result.Latest | Should -Match '^\d+\.\d+\.\d+$' >> } >> } >> Describing Get-CurlVersion [-] 返回有效的版本对象 180ms RuntimeException: '-Not' is not a valid Should operator. 在 Get-TestResult、C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0\Functions\Assertions\Should.ps1 中: 第 42 行 在 Should<End>、C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0\Functions\Assertions\Should.ps1 中: 第 83 行 在 <ScriptBlock>、<无文件> 中: 第 5 行 在 Invoke-Test、C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0\Functions\It.ps1 中: 第 253 行 在 ItImpl、C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0\Functions\It.ps1 中: 第 203 行 在 It、C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0\Functions\It.ps1 中: 第 117 行 在 <ScriptBlock>、<无文件> 中: 第 3 行 在 Describe、C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0\Functions\Describe.ps1 中: 第 100 行 在 <ScriptBlock>、<无文件> 中: 第 2 行 PS C:\Users\Administrator> # 安装 PlatyPS >> Install-Module -Name PlatyPS -Force >> >> # 生成帮助文档 >> New-MarkdownHelp -Module CurlTools -OutputFolder docs >> 需要使用 NuGet 提供程序来继续操作 PowerShellGet 需要使用 NuGet 提供程序“2.8.5.201”或更高版本来与基于 NuGet 的存储库交互。必须在“C:\Program Files\PackageManagement\ProviderAssemblies”或“C:\Users\Administrator\AppData\Local\PackageManagement\ProviderAssembli es”中提供 NuGet 提供程序。也可以通过运行 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force' 安装 NuGet 提供程序。是否要让 PowerShellGet 立即安装并导入 NuGet 提供程序? [Y] 是(Y) [N] 否(N) [S] 暂停(S) [?] 帮助 (默认值为“Y”):
08-13
CommandType Name Version Source ----------- ---- ------- ------ Alias Get-PSResource 1.1.1 Microsoft.PowerShell.PSResourceGet Function Compress-Archive 1.2.5 Microsoft.PowerShell.Archive Function Compress-Archive 1.0.1.0 Microsoft.PowerShell.Archive Function ConvertFrom-SddlString 3.1.0.0 Microsoft.PowerShell.Utility Function Expand-Archive 1.2.5 Microsoft.PowerShell.Archive Function Expand-Archive 1.0.1.0 Microsoft.PowerShell.Archive Function Export-ODataEndpointProxy 1.0 Microsoft.PowerShell.ODataUtils Function Format-Hex 3.1.0.0 Microsoft.PowerShell.Utility Function Get-FileHash 3.1.0.0 Microsoft.PowerShell.Utility Function Get-OperationValidation 1.0.1 Microsoft.PowerShell.Operation.Validation Function Import-PowerShellDataFile 3.1.0.0 Microsoft.PowerShell.Utility Function Import-PSGetRepository 1.1.1 Microsoft.PowerShell.PSResourceGet Function Invoke-OperationValidation 1.0.1 Microsoft.PowerShell.Operation.Validation Function New-Guid 3.1.0.0 Microsoft.PowerShell.Utility Function New-TemporaryFile 3.1.0.0 Microsoft.PowerShell.Utility Cmdlet Add-Computer 3.1.0.0 Microsoft.PowerShell.Management Cmdlet Add-Content 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Add-History 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Add-LocalGroupMember 1.0.0.0 Microsoft.PowerShell.LocalAccounts Cmdlet Add-Member 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Add-Type 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Checkpoint-Computer 3.1.0.0 Microsoft.PowerShell.Management Cmdlet Clear-Content 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Clear-EventLog 3.1.0.0 Microsoft.PowerShell.Management Cmdlet Clear-History 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Clear-Item 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Clear-ItemProperty 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Clear-RecycleBin 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Clear-Variable 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Compare-Object 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Complete-Transaction 3.1.0.0 Microsoft.PowerShell.Management Cmdlet Compress-PSResource 1.1.1 Microsoft.PowerShell.PSResourceGet Cmdlet Connect-PSSession 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Convert-Path 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Convert-String 3.1.0.0 Microsoft.PowerShell.Utility Cmdlet ConvertFrom-CliXml 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet ConvertFrom-Csv 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet ConvertFrom-Json 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet ConvertFrom-Markdown 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet ConvertFrom-SddlString 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet ConvertFrom-SecureString 7.0.0.0 Microsoft.PowerShell.Security Cmdlet ConvertFrom-String 3.1.0.0 Microsoft.PowerShell.Utility Cmdlet ConvertFrom-StringData 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet ConvertTo-CliXml 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet ConvertTo-Csv 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet ConvertTo-Html 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet ConvertTo-Json 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet ConvertTo-SecureString 7.0.0.0 Microsoft.PowerShell.Security Cmdlet ConvertTo-Xml 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Copy-Item 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Copy-ItemProperty 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Debug-Job 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Debug-Process 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Debug-Runspace 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Disable-ComputerRestore 3.1.0.0 Microsoft.PowerShell.Management Cmdlet Disable-ExperimentalFeature 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Disable-LocalUser 1.0.0.0 Microsoft.PowerShell.LocalAccounts Cmdlet Disable-PSBreakpoint 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Disable-PSRemoting 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Disable-PSSessionConfiguration 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Disable-RunspaceDebug 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Disconnect-PSSession 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Enable-ComputerRestore 3.1.0.0 Microsoft.PowerShell.Management Cmdlet Enable-ExperimentalFeature 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Enable-LocalUser 1.0.0.0 Microsoft.PowerShell.LocalAccounts Cmdlet Enable-PSBreakpoint 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Enable-PSRemoting 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Enable-PSSessionConfiguration 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Enable-RunspaceDebug 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Enter-PSHostProcess 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Enter-PSSession 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Exit-PSHostProcess 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Exit-PSSession 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Export-Alias 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Export-Clixml 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Export-Counter 3.0.0.0 Microsoft.PowerShell.Diagnostics Cmdlet Export-Csv 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Export-FormatData 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Export-ModuleMember 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Export-PSSession 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Find-PSResource 1.1.1 Microsoft.PowerShell.PSResourceGet Cmdlet ForEach-Object 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Format-Custom 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Format-Hex 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Format-List 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Format-Table 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Format-Wide 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Get-Acl 7.0.0.0 Microsoft.PowerShell.Security Cmdlet Get-Alias 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Get-AuthenticodeSignature 7.0.0.0 Microsoft.PowerShell.Security Cmdlet Get-ChildItem 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Get-Clipboard 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Get-CmsMessage 7.0.0.0 Microsoft.PowerShell.Security Cmdlet Get-Command 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Get-ComputerInfo 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Get-ComputerRestorePoint 3.1.0.0 Microsoft.PowerShell.Management Cmdlet Get-Content 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Get-ControlPanelItem 3.1.0.0 Microsoft.PowerShell.Management Cmdlet Get-Counter 7.0.0.0 Microsoft.PowerShell.Diagnostics Cmdlet Get-Credential 7.0.0.0 Microsoft.PowerShell.Security Cmdlet Get-Culture 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Get-Date 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Get-Error 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Get-Event 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Get-EventLog 3.1.0.0 Microsoft.PowerShell.Management Cmdlet Get-EventSubscriber 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Get-ExecutionPolicy 7.0.0.0 Microsoft.PowerShell.Security Cmdlet Get-ExperimentalFeature 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Get-FileHash 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Get-FormatData 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Get-Help 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Get-History 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Get-Host 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Get-HotFix 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Get-InstalledPSResource 1.1.1 Microsoft.PowerShell.PSResourceGet Cmdlet Get-Item 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Get-ItemProperty 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Get-ItemPropertyValue 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Get-Job 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Get-LocalGroup 1.0.0.0 Microsoft.PowerShell.LocalAccounts Cmdlet Get-LocalGroupMember 1.0.0.0 Microsoft.PowerShell.LocalAccounts Cmdlet Get-LocalUser 1.0.0.0 Microsoft.PowerShell.LocalAccounts Cmdlet Get-Location 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Get-MarkdownOption 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Get-Member 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Get-Module 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Get-PfxCertificate 7.0.0.0 Microsoft.PowerShell.Security Cmdlet Get-Process 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Get-PSBreakpoint 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Get-PSCallStack 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Get-PSDrive 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Get-PSHostProcessInfo 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Get-PSProvider 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Get-PSResourceRepository 1.1.1 Microsoft.PowerShell.PSResourceGet Cmdlet Get-PSScriptFileInfo 1.1.1 Microsoft.PowerShell.PSResourceGet Cmdlet Get-PSSession 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Get-PSSessionCapability 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Get-PSSessionConfiguration 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Get-PSSubsystem 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Get-Random 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Get-Runspace 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Get-RunspaceDebug 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Get-SecureRandom 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Get-Service 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Get-TimeZone 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Get-TraceSource 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Get-Transaction 3.1.0.0 Microsoft.PowerShell.Management Cmdlet Get-TypeData 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Get-UICulture 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Get-Unique 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Get-Uptime 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Get-Variable 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Get-Verb 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Get-WinEvent 7.0.0.0 Microsoft.PowerShell.Diagnostics Cmdlet Get-WmiObject 3.1.0.0 Microsoft.PowerShell.Management Cmdlet Group-Object 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Import-Alias 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Import-Clixml 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Import-Counter 3.0.0.0 Microsoft.PowerShell.Diagnostics Cmdlet Import-Csv 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Import-LocalizedData 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Import-Module 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Import-PowerShellDataFile 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Import-PSSession 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Install-PSResource 1.1.1 Microsoft.PowerShell.PSResourceGet Cmdlet Invoke-Command 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Invoke-Expression 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Invoke-History 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Invoke-Item 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Invoke-RestMethod 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Invoke-WebRequest 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Invoke-WmiMethod 3.1.0.0 Microsoft.PowerShell.Management Cmdlet Join-Path 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Join-String 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Limit-EventLog 3.1.0.0 Microsoft.PowerShell.Management Cmdlet Measure-Command 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Measure-Object 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Move-Item 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Move-ItemProperty 7.0.0.0 Microsoft.PowerShell.Management Cmdlet New-Alias 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet New-Event 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet New-EventLog 3.1.0.0 Microsoft.PowerShell.Management Cmdlet New-FileCatalog 7.0.0.0 Microsoft.PowerShell.Security Cmdlet New-Guid 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet New-Item 7.0.0.0 Microsoft.PowerShell.Management Cmdlet New-ItemProperty 7.0.0.0 Microsoft.PowerShell.Management Cmdlet New-LocalGroup 1.0.0.0 Microsoft.PowerShell.LocalAccounts Cmdlet New-LocalUser 1.0.0.0 Microsoft.PowerShell.LocalAccounts Cmdlet New-Module 7.6.0.4 Microsoft.PowerShell.Core Cmdlet New-ModuleManifest 7.6.0.4 Microsoft.PowerShell.Core Cmdlet New-Object 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet New-PSDrive 7.0.0.0 Microsoft.PowerShell.Management Cmdlet New-PSRoleCapabilityFile 7.6.0.4 Microsoft.PowerShell.Core Cmdlet New-PSScriptFileInfo 1.1.1 Microsoft.PowerShell.PSResourceGet Cmdlet New-PSSession 7.6.0.4 Microsoft.PowerShell.Core Cmdlet New-PSSessionConfigurationFile 7.6.0.4 Microsoft.PowerShell.Core Cmdlet New-PSSessionOption 7.6.0.4 Microsoft.PowerShell.Core Cmdlet New-PSTransportOption 7.6.0.4 Microsoft.PowerShell.Core Cmdlet New-Service 7.0.0.0 Microsoft.PowerShell.Management Cmdlet New-TemporaryFile 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet New-TimeSpan 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet New-Variable 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet New-WebServiceProxy 3.1.0.0 Microsoft.PowerShell.Management Cmdlet New-WinEvent 7.0.0.0 Microsoft.PowerShell.Diagnostics Cmdlet Out-Default 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Out-File 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Out-GridView 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Out-Host 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Out-Null 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Out-Printer 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Out-String 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Pop-Location 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Protect-CmsMessage 7.0.0.0 Microsoft.PowerShell.Security Cmdlet Publish-PSResource 1.1.1 Microsoft.PowerShell.PSResourceGet Cmdlet Push-Location 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Read-Host 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Receive-Job 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Receive-PSSession 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Register-ArgumentCompleter 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Register-EngineEvent 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Register-ObjectEvent 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Register-PSResourceRepository 1.1.1 Microsoft.PowerShell.PSResourceGet Cmdlet Register-PSSessionConfiguration 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Register-WmiEvent 3.1.0.0 Microsoft.PowerShell.Management Cmdlet Remove-Alias 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Remove-Computer 3.1.0.0 Microsoft.PowerShell.Management Cmdlet Remove-Event 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Remove-EventLog 3.1.0.0 Microsoft.PowerShell.Management Cmdlet Remove-Item 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Remove-ItemProperty 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Remove-Job 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Remove-LocalGroup 1.0.0.0 Microsoft.PowerShell.LocalAccounts Cmdlet Remove-LocalGroupMember 1.0.0.0 Microsoft.PowerShell.LocalAccounts Cmdlet Remove-LocalUser 1.0.0.0 Microsoft.PowerShell.LocalAccounts Cmdlet Remove-Module 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Remove-PSBreakpoint 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Remove-PSDrive 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Remove-PSSession 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Remove-Service 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Remove-TypeData 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Remove-Variable 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Remove-WmiObject 3.1.0.0 Microsoft.PowerShell.Management Cmdlet Rename-Computer 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Rename-Item 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Rename-ItemProperty 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Rename-LocalGroup 1.0.0.0 Microsoft.PowerShell.LocalAccounts Cmdlet Rename-LocalUser 1.0.0.0 Microsoft.PowerShell.LocalAccounts Cmdlet Reset-ComputerMachinePassword 3.1.0.0 Microsoft.PowerShell.Management Cmdlet Resolve-Path 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Restart-Computer 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Restart-Service 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Restore-Computer 3.1.0.0 Microsoft.PowerShell.Management Cmdlet Resume-Service 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Save-Help 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Save-PSResource 1.1.1 Microsoft.PowerShell.PSResourceGet Cmdlet Select-Object 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Select-String 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Select-Xml 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Send-MailMessage 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Set-Acl 7.0.0.0 Microsoft.PowerShell.Security Cmdlet Set-Alias 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Set-AuthenticodeSignature 7.0.0.0 Microsoft.PowerShell.Security Cmdlet Set-Clipboard 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Set-Content 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Set-Date 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Set-ExecutionPolicy 7.0.0.0 Microsoft.PowerShell.Security Cmdlet Set-Item 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Set-ItemProperty 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Set-LocalGroup 1.0.0.0 Microsoft.PowerShell.LocalAccounts Cmdlet Set-LocalUser 1.0.0.0 Microsoft.PowerShell.LocalAccounts Cmdlet Set-Location 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Set-MarkdownOption 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Set-PSBreakpoint 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Set-PSDebug 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Set-PSResourceRepository 1.1.1 Microsoft.PowerShell.PSResourceGet Cmdlet Set-PSSessionConfiguration 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Set-Service 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Set-StrictMode 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Set-TimeZone 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Set-TraceSource 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Set-Variable 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Set-WmiInstance 3.1.0.0 Microsoft.PowerShell.Management Cmdlet Show-Command 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Show-ControlPanelItem 3.1.0.0 Microsoft.PowerShell.Management Cmdlet Show-EventLog 3.1.0.0 Microsoft.PowerShell.Management Cmdlet Show-Markdown 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Sort-Object 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Split-Path 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Start-Job 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Start-Process 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Start-Service 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Start-Sleep 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Start-ThreadJob 2.2.0 Microsoft.PowerShell.ThreadJob Cmdlet Start-Transaction 3.1.0.0 Microsoft.PowerShell.Management Cmdlet Start-Transcript 7.0.0.0 Microsoft.PowerShell.Host Cmdlet Stop-Computer 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Stop-Job 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Stop-Process 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Stop-Service 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Stop-Transcript 7.0.0.0 Microsoft.PowerShell.Host Cmdlet Suspend-Service 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Tee-Object 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Test-ComputerSecureChannel 3.1.0.0 Microsoft.PowerShell.Management Cmdlet Test-Connection 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Test-FileCatalog 7.0.0.0 Microsoft.PowerShell.Security Cmdlet Test-Json 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Test-ModuleManifest 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Test-Path 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Test-PSScriptFileInfo 1.1.1 Microsoft.PowerShell.PSResourceGet Cmdlet Test-PSSessionConfigurationFile 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Trace-Command 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Unblock-File 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Undo-Transaction 3.1.0.0 Microsoft.PowerShell.Management Cmdlet Uninstall-PSResource 1.1.1 Microsoft.PowerShell.PSResourceGet Cmdlet Unprotect-CmsMessage 7.0.0.0 Microsoft.PowerShell.Security Cmdlet Unregister-Event 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Unregister-PSResourceRepository 1.1.1 Microsoft.PowerShell.PSResourceGet Cmdlet Unregister-PSSessionConfiguration 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Update-FormatData 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Update-Help 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Update-List 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Update-PSModuleManifest 1.1.1 Microsoft.PowerShell.PSResourceGet Cmdlet Update-PSResource 1.1.1 Microsoft.PowerShell.PSResourceGet Cmdlet Update-PSScriptFileInfo 1.1.1 Microsoft.PowerShell.PSResourceGet Cmdlet Update-TypeData 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Use-Transaction 3.1.0.0 Microsoft.PowerShell.Management Cmdlet Wait-Debugger 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Wait-Event 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Wait-Job 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Wait-Process 7.0.0.0 Microsoft.PowerShell.Management Cmdlet Where-Object 7.6.0.4 Microsoft.PowerShell.Core Cmdlet Write-Debug 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Write-Error 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Write-EventLog 3.1.0.0 Microsoft.PowerShell.Management Cmdlet Write-Host 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Write-Information 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Write-Output 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Write-Progress 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Write-Verbose 7.0.0.0 Microsoft.PowerShell.Utility Cmdlet Write-Warning 7.0.0.0 Microsoft.PowerShell.Utility这些命令分别是什么意思
06-22
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值