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 10

    Microsoft Edgeを操作するVBScript

    「Microsoft Edgeを操作するVBAマクロ(WebDrive…

  2. Windows 10

    [Windows 10]切り取り&スケッチを起動するショートカット

    Windows 10の「切り取り&スケッチ」機能、皆さん使ってますでし…

  3. Windows関連

    Windows 8 Consumer PreviewにMicrosoft Security Esse…

    ※ 下記はWindows 8 Consumer Preview(日本語…

  4. Windows 10

    [Windows 10]ナビゲーションウィンドウにあるOneDriveを非表示にする。

    ※ レジストリを編集する作業は自己責任で行ってください。Win…

  5. Windows 10

    [Windows 10]このデバイスの〇〇へのアクセスを制御するレジストリ情報

    Windows 10のの中に、「このデバイスのドキュメント ライブラリ…

  6. Windows 10

    WebDriverを使わずMicrosoft Edgeを制御するC#コード

    以前書いた記事のように、Microsoft EdgeにはInterne…

コメント

  • コメント (0)

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

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

Time limit is exhausted. Please reload CAPTCHA.

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

Translate

最近の記事

アーカイブ

PAGE TOP