首页 > 解决方案 > 在脚本的 PowerShell 帮助中省略路径?

问题描述

当我调用Get-Help My-Script.ps1 -Full时,我的脚本名称总是显示在脚本的完整路径前面。

这非常丑陋,并且分散了我在帮助文本中提供的真正重要信息的注意力。

是否有一个选项Get-Help只显示脚本名称 - 没有路径 - 可能只在前面加上.\

编辑

这是一个 CmdLet 示例:

<#
.SYNOPSIS

Initializes installation specific configuration data.

.DESCRIPTION

Updates rows in the database table.

.PARAMETER DataRootPath

Root path of runtime data to be stored.

.PARAMETER WebApiBaseUrl

Base path of Web API.
#>

然后,我在 CmdLet 上请求帮助,我得到以下输出:

PS D:\Documents\Visual Studio-Projekte\Installation\2 - IIS Setup> get-help .\Configure-IIS.ps1 -Full 


NAME
    D:\Documents\Visual Studio-Projekte\Installation\2 - IIS Setup\Configure-IIS.ps1

SYNOPSIS
    Initializes installation specific configuration data.

    
SYNTAX
    D:\Documents\Visual Studio-Projekte\Installation\2 - IIS Setup\Configure-IIS.ps1 [<CommonParameters>]


DESCRIPTION
    Updates rows in the database table.


PARAMETERS
    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer, PipelineVariable, and OutVariable. For more information, see
        about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).

INPUTS

OUTPUTS


RELATED LINKS

我宁愿得到这个(请注意 NAME 和 SYNTAX 部分的区别):

PS D:\Documents\Visual Studio-Projekte\Installation\2 - IIS Setup> get-help .\Configure-IIS.ps1 -Full 


NAME
    .\Configure-IIS.ps1

SYNOPSIS
    Initializes installation specific configuration data.

    
SYNTAX
    .\Configure-IIS.ps1 [<CommonParameters>]


DESCRIPTION
    Updates rows in the database table.


PARAMETERS
    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer, PipelineVariable, and OutVariable. For more information, see
        about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).

INPUTS

OUTPUTS


RELATED LINKS

标签: powershellpowershell-7.0

解决方案


推荐阅读