WMI Fun !! 〜 WMI に興味がある方・システム管理者は必見です! 〜 |
|
![]() |
WMI Fun !! > WMI Sample (VBS) > 第 x 四半期を取得する |
第 x 四半期を取得する: Win32_LocalTime - WMI Sample (VBS)Topics
現在第 x 四半期であるか取得するサンプルプログラムです。
Sample Code
Option Explicit
'WMIにて使用する各種オブジェクトを定義・生成する。 Dim oClassSet Dim oClass Dim oLocator Dim oService Dim sMesStr 'ローカルコンピュータに接続する。 Set oLocator = WScript.CreateObject("WbemScripting.SWbemLocator") Set oService = oLocator.ConnectServer 'クエリー条件を WQL にて指定する。 Set oClassSet = oService.ExecQuery("Select * From Win32_LocalTime") 'コレクションを解析する。 For Each oClass In oClassSet sMesStr = "今日は、" & oClass.Month & " 月 " & oClass.Day & " 日です。" & _ "第 " & oClass.Quarter & " 四半期です。" Next MsgBox sMesStr '使用した各種オブジェクトを後片付けする。 Set oClassSet = Nothing Set oClass = Nothing Set oService = Nothing Set oLocator = Nothing
![]() Comment
実行すると今日の日にちと、現在の四半期を表示します。Win32_LocalTime には Quarter プロパティが用意されている為、簡単に取得が可能です。 ![]() Latest sample information
最近WMI Sampleへ追加したサンプルのご紹介です。
興味のあるサンプル・クラスがありましたら参考にしてみて下さい。 |
ご意見・ご要望・ご感想をこちらのアンケートからお待ちしています |
∧ ページの先頭へ… |