Windows関連

OSのバージョン情報をクリップボードにコピーするVBScript

OSのバージョンやビルド番号をブログの記事内に書くことがあるのですが、いちいちシステム情報を見るのは面倒くさいので、バージョン情報を直接クリップボードにコピーするスクリプトを書きました。

Option Explicit

'OSのバージョン情報をクリップボードにコピー
PutInClipboardText GetOSVersion()
'WScript.Echo GetOSVersion() '確認用

Private Function GetOSVersion()
  Dim colItems
  Dim itm
  Dim ret
  
  Set colItems = CreateObject("WbemScripting.SWbemLocator") _
                   .ConnectServer _
                   .ExecQuery("Select * From Win32_OperatingSystem")
  For Each itm In colItems
    ret = "OS名:" & itm.Caption & " " & "バージョン:" & itm.Version & " ビルド " & itm.BuildNumber
  Next
  GetOSVersion = ret
End Function

Public Sub PutInClipboardText(ByVal str)
'https://www.ka-net.org/blog/?p=1563
  Dim cmd
   
  cmd = "cmd /c ""echo " & str & "| clip"""
  CreateObject("WScript.Shell").Run cmd, 0
End Sub

文字列をクリップボードにコピーする処理は、下記記事のコードをそのまま使っています。

関連記事

Microsoft Edgeのお気に入りをHTML形式でインポート・エクスポートする。前のページ

Microsoft Edgeのバージョン情報をクリップボードにコピーするVBScript次のページ

関連記事

  1. Windows関連

    [Windows 8]拡張子を表示する。

    ※ 下記はWindows Developer Preview(英語版・…

  2. Windows関連

    [Windows 8]自動的にログオンする。

    ※ 下記はWindows Developer Preview(英語版・…

  3. Windows 10

    Windows Insider Meetup in Japan 2 東京に参加しました。

    6月25日(日)に品川の日本マイクロソフト株式会社で開催された「Win…

  4. Windows関連

    Windows 10 IMEの「クラウド候補機能」の仕組みを追ってみた。

    「ついにWindows 10 日本語IMEにクラウド候補機能が搭載され…

  5. Windows 10

    Microsoft Edgeを起動するVBScript

    前回の記事の関連ですが、下記コードのようにShellExecuteメソ…

コメント

  • コメント (0)

  • トラックバックは利用できません。

  1. この記事へのコメントはありません。

Time limit is exhausted. Please reload CAPTCHA.

※本ページはプロモーションが含まれています。

Translate

最近の記事

アーカイブ

PAGE TOP