Help us understand the problem. What is going on with this article?

PCの基本スペックをラベル印刷するためにテキストで取得する

Label

Powershellで

Write-Host "OS:`t" (Get-WmiObject Win32_OperatingSystem).Caption
Write-Host "CPU:`t" (Get-WmiObject Win32_Processor).Name
Write-Host "Memory:`t" ([System.Convert]::ToInt32((Get-WmiObject Win32_ComputerSystem).TotalPhysicalMemory/(1024*1024*1024))) "GB"
Write-Host "GPU:`t" (Get-WmiObject Win32_VideoController).Name
pause
  • Write-Host でそのあとに続く引数をテキストでPowerShellに出力
  • Get-WmiObject でオブジェクトを得る
  • メモリについては Byte から GB に変換した上で ToInt32 で丸める
  • `t はタブ

↑のファイルを .ps1 フォーマットで作成し、右クリックして Run with PowerShell で実行できますが、権限の関係でできないかもしれません。
その場合はセミコロン区切りで1行にして PowerShell にコピペして実行が楽だと思います。

Write-Host "OS:`t" (Get-WmiObject Win32_OperatingSystem).Caption;Write-Host "CPU:`t" (Get-WmiObject Win32_Processor).Name;Write-Host "Memory:`t" ([System.Convert]::ToInt32((Get-WmiObject Win32_ComputerSystem).TotalPhysicalMemory/(1024*1024*1024))) "GB";Write-Host "GPU:`t" (Get-WmiObject Win32_VideoController).Name

実行すると次のようなテキストが得られます。

OS:      Microsoft Windows 10 Home
CPU:     Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz
Memory:  16 GB
GPU:     NVIDIA GeForce GTX 1080 Ti

これをどうにかしてテプラで印刷します。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした