Feb 21, 2007

[dotNet] Windows PowerShell にチャレンジ (3)

Windows PowerShell のヘルプ機能

コマンドの使用方法が良く分からないものも多数あるので、ヘルプを表示してみる。

PS C:\> Help Get-Date

NAME
    Get-Date

SYNOPSIS
    Gets the current date and time.


SYNTAX
    Get-Date [[-date] <DateTime>] [-displayHint {<Date> | <Time> | <DateTime>}]
     [-format <string>] [-year <int>] [-month <int>] [-day <int>] [-hour <int>]
     [-minute <int>] [-second <int>] [<CommonParameters>]

    Get-Date [[-date] <DateTime>] [-displayHint {<Date> | <Time> | <DateTime>}]
     [-uFormat <string>] [-year <int>] [-month <int>] [-day <int>] [-hour <int>
    ] [-minute <int>] [-second <int>] [<CommonParameters>]


DETAILED DESCRIPTION
    Gets the current date and time.


RELATED LINKS
    Set-Date
    New-TimeSpan

REMARKS
    For more information, type: "get-help Get-Date -detailed".
    For technical information, type: "get-help Get-Date -full".

PS C:\>
ということで、Get-Date の使用方法が分かったので、ちょっと使ってみる。
PS C:\> Get-Date -format yyyy
2007
PS C:\> Get-Date -format yyyyMMdd
20070129
PS C:\> Get-Date -format yyyyMMddHHmmss
20070129013010
PS C:\>
ちなみに、UNIX 風に問い合わせてみると、
PS C:\> man date

Name                       Category                   Synopsis
----                       --------                   --------
Get-Date                   Cmdlet                     Gets the current date ...
Set-Date                   Cmdlet                     Changes the system tim...
となった。やはり "Get-Help Get-Date" で問い合わせてくれ、ということなのだろう。