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 8のアプリを紹介し…

  2. Windows 10

    「ファイル名を指定して実行」からMicrosoft Edgeを起動する

    以前書いた記事で、Microsoft EdgeをVBScriptから起…

  3. Windows関連

    どのブラウザーが最強なのかを調べてみたよ。

    Internet Explorer、Chrome、Firefox…数あ…

  4. Windows 11

    Windows 11をクリーンインストールしてみました。

    下記記事にもあるように、10月5日(日本時間)にWindows 11が…

コメント

  • コメント (0)

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

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

Time limit is exhausted. Please reload CAPTCHA.

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

Translate

最近の記事

アーカイブ

PAGE TOP