PowerShell/PowerShellスクリプトの複数行コメントアウト方法
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
開始行:
#navi(../)
* PowerShellスクリプトの複数行コメントアウト方法 <# .. #>...
本記事は、PowerShellスクリプトを複数行コメントアウト化す...
#contents
#htmlinsertpcsp(win-top.html,win-sp.html)
* 関連記事 [#x1510b5b]
-[[PowerShellスクリプトを起動できるようにする>PowerShell/...
**[[linux.just4fun.biz>http://linux.just4fun.biz]]の記事...
-[[シェルスクリプトで複数行をまとめてコメントアウトする方...
* 複数行をコメント化してみる [#i68c7187]
以下のスクリプトで複数行を <# .. #> でコメント化して実行...
#ref(tst.ps1)
Write-Output "Windows 3.1"
Write-Output "Windows 95"
Write-Output "Windows 98"
Write-Output "Windows NT"
Write-Output "Windows 2000"
Write-Output "Windows Me"
Write-Output "Windows XP"
Write-Output "Windows Vista"
Write-Output "Windows 7"
Write-Output "Windows 8"
Write-Output "Windows 8.1"
Write-Output "Windows 10"
** 複数行コメント化前の実行結果 [#s09feb15]
コメントする前の実行結果です。
PS D:\> .\tst.ps1
Windows 3.1
Windows 95
Windows 98
Windows NT
Windows 2000
Windows Me
Windows XP
Windows Vista
Windows 7
Windows 8
Windows 8.1
Windows 10
** 複数行コメント化後の実行結果 [#d73a0416]
以下の様にコメントしました。
#ref(tst2.ps1)
Write-Output "Windows 3.1"
<# Write-Output "Windows 95"
Write-Output "Windows 98"
Write-Output "Windows NT"
Write-Output "Windows 2000"
Write-Output "Windows Me"
Write-Output "Windows XP"
Write-Output "Windows Vista"
Write-Output "Windows 7"
Write-Output "Windows 8"
Write-Output "Windows 8.1" #>
Write-Output "Windows 10"
上記例では、各行の先頭と末尾に <#と#>を記述しました。~
以下の様に別行に書いても同様の動作をします。
Write-Output "Windows 3.1"
<#
Write-Output "Windows 95"
<省略>
Write-Output "Windows 8.1"
#>
Write-Output "Windows 10"
コメント化の実行結果です。
PS D:\> .\tst2.ps1
Windows 3.1
Windows 10
以上、PowerShellで複数行をコメント化する記述方法の紹介で...
#htmlinsertpcsp(win-btm.html,win-sp.html)
終了行:
#navi(../)
* PowerShellスクリプトの複数行コメントアウト方法 <# .. #>...
本記事は、PowerShellスクリプトを複数行コメントアウト化す...
#contents
#htmlinsertpcsp(win-top.html,win-sp.html)
* 関連記事 [#x1510b5b]
-[[PowerShellスクリプトを起動できるようにする>PowerShell/...
**[[linux.just4fun.biz>http://linux.just4fun.biz]]の記事...
-[[シェルスクリプトで複数行をまとめてコメントアウトする方...
* 複数行をコメント化してみる [#i68c7187]
以下のスクリプトで複数行を <# .. #> でコメント化して実行...
#ref(tst.ps1)
Write-Output "Windows 3.1"
Write-Output "Windows 95"
Write-Output "Windows 98"
Write-Output "Windows NT"
Write-Output "Windows 2000"
Write-Output "Windows Me"
Write-Output "Windows XP"
Write-Output "Windows Vista"
Write-Output "Windows 7"
Write-Output "Windows 8"
Write-Output "Windows 8.1"
Write-Output "Windows 10"
** 複数行コメント化前の実行結果 [#s09feb15]
コメントする前の実行結果です。
PS D:\> .\tst.ps1
Windows 3.1
Windows 95
Windows 98
Windows NT
Windows 2000
Windows Me
Windows XP
Windows Vista
Windows 7
Windows 8
Windows 8.1
Windows 10
** 複数行コメント化後の実行結果 [#d73a0416]
以下の様にコメントしました。
#ref(tst2.ps1)
Write-Output "Windows 3.1"
<# Write-Output "Windows 95"
Write-Output "Windows 98"
Write-Output "Windows NT"
Write-Output "Windows 2000"
Write-Output "Windows Me"
Write-Output "Windows XP"
Write-Output "Windows Vista"
Write-Output "Windows 7"
Write-Output "Windows 8"
Write-Output "Windows 8.1" #>
Write-Output "Windows 10"
上記例では、各行の先頭と末尾に <#と#>を記述しました。~
以下の様に別行に書いても同様の動作をします。
Write-Output "Windows 3.1"
<#
Write-Output "Windows 95"
<省略>
Write-Output "Windows 8.1"
#>
Write-Output "Windows 10"
コメント化の実行結果です。
PS D:\> .\tst2.ps1
Windows 3.1
Windows 10
以上、PowerShellで複数行をコメント化する記述方法の紹介で...
#htmlinsertpcsp(win-btm.html,win-sp.html)
ページ名: