PowerShell でコードをコメントアウトするにはどうすればいいですか? 質問する

PowerShell でコードをコメントアウトするにはどうすればいいですか? 質問する

PowerShell (1.0 または 2.0)でコードをコメント アウトするにはどうすればよいですか?

ベストアンサー1

#PowerShell V1 では、その後のテキストをコメントにするだけです。

# This is a comment in PowerShell

PowerShell V2 では<# #>、ブロック コメント、具体的にはヘルプ コメントに使用できます。

#REQUIRES -Version 2.0

<#
.SYNOPSIS
    A brief description of the function or script. This keyword can be used
    only once in each topic.
.DESCRIPTION
    A detailed description of the function or script. This keyword can be
    used only once in each topic.
.NOTES
    File Name      : xxxx.ps1
    Author         : J.P. Blanc ([email protected])
    Prerequisite   : PowerShell V2 over Vista and upper.
    Copyright 2011 - Jean Paul Blanc/Silogix
.LINK
    Script posted over:
    http://silogix.fr
.EXAMPLE
    Example 1
.EXAMPLE
    Example 2
#>
Function blabla
{}

詳しい説明について.SYNOPSIS.*コメントベースのヘルプについて

注意: これらの関数コメントは CmdLet によって使用されGet-Help、キーワードの前Function、または{}コード自体の前または後に配置できます。

おすすめ記事