綁定帳號登入

Android 台灣中文網

打印 上一主題 下一主題

[系統工具] 【25/02/28】Win資訊顯示器 v2 重製版 (樓主自製+完全開源)

  [複製連結] 查看: 4358|回覆: 38|好評: 0
31
mp220694 | 收聽TA | 只看該作者
發表於 2025-3-1 17:56
我的Win11專業版執行正常,感謝樓主。

評分

參與人數 1碎鑽 +1 幫助 +1 收起 理由
love_apktw + 1 + 1 非常讃

查看全部評分

用Android 就來Android 台灣中文網(https://apk.tw)
回覆 支持 反對

使用道具 舉報

32
good7 | 收聽TA | 只看該作者
發表於 2025-3-1 18:23
謝謝。

我將它編譯成 .exe 檔了,有興趣的人可以自行下載。
https://u.pcloud.link/publink/sh ... SyNtB1UfXTS5YoQudfX


評分

參與人數 1碎鑽 +1 幫助 +1 收起 理由
blackch + 1 + 1 非常讃

查看全部評分

用Android 就來Android 台灣中文網(https://apk.tw)
回覆 支持 反對

使用道具 舉報

33
crihy | 收聽TA | 只看該作者
發表於 2025-3-1 19:00
love_apktw 發表於 2025-3-1 14:55
這個是掃毒畫面,用來證明這個小程式沒病毒,看不到這個畫面很正常

感謝樓主大大提供改版、測試分享及回復

評分

參與人數 1碎鑽 +1 幫助 +1 收起 理由
love_apktw + 1 + 1 非常讃

查看全部評分

用Android 就來Android 台灣中文網(https://apk.tw)
回覆 支持 反對

使用道具 舉報

34
Kevindai | 收聽TA | 只看該作者
發表於 2025-3-1 19:39
謝謝大大分享
想請問有沒有辦法做到
透過一台主機 去遠端撈取另外十台主機資訊 然後回報成csv格式
謝謝

評分

參與人數 1幫助 +1 收起 理由
love_apktw + 1 好內容,老衲來為這篇文章開開光.

查看全部評分

用Android 就來Android 台灣中文網(https://apk.tw)
回覆 支持 反對

使用道具 舉報

35
 樓主| love_apktw | 收聽TA | 只看該作者
發表於 2025-3-1 19:41
Kevindai 發表於 2025-3-1 19:39
謝謝大大分享
想請問有沒有辦法做到
透過一台主機 去遠端撈取另外十台主機資訊 然後回報成csv格式

太難了,我想做,但是辦不到
用Android 就來Android 台灣中文網(https://apk.tw)
回覆 支持 反對

使用道具 舉報

36
jsgoodman | 收聽TA | 只看該作者
發表於 2025-3-1 21:30
感謝版大的用心
這個版本執行正常
辛苦囉,有興趣非常重要
想必你已經將DOS指令摸得很熟囉!
另外前一版 V2 版,我發現是在顯示CPU以及GPU的這2行發生瞬退的狀況。
一點點小小的分享。

加油,版主

評分

參與人數 1幫助 +1 收起 理由
love_apktw + 1 好內容,老衲來為這篇文章開開光.

查看全部評分

用Android 就來Android 台灣中文網(https://apk.tw)
回覆 支持 反對

使用道具 舉報

37
mp220694 | 收聽TA | 只看該作者
發表於 2025-3-1 22:58
樓主,剛剛用 deepSeek 詢問是否需有建議。deepSeek回復如下

程式內容有沒有錯誤
這個批次檔案的內容看起來大致上是正確的,並且能夠執行其預期的功能,即顯示 Windows 系統的各種資訊。不過,有一些小問題和改進建議可以提出來:

變數未定義:

在 $cpu_name_temp 的處理中,有一個條件判斷 if (-not $cpu_name),但 $cpu_name 在這之前並未被定義。這可能會導致錯誤。建議將條件判斷改為 if (-not $cpu_name_temp)。

錯誤處理:

在獲取 $product_key 和 $install_date 時,使用了 try-catch 來處理可能的錯誤,這是一個好的做法。不過,其他部分(如 $cpu_name 和 $gpu_name)也可以考慮加入類似的錯誤處理,以確保程式在遇到問題時不會崩潰。

記憶體大小顯示:

在顯示記憶體大小時,$ram_size_B 的值可能會為 null,這會導致 $ram_size_GB 也為 null。建議在計算 $ram_size_GB 之前,先檢查 $ram_size_B 是否為 null。

顯示卡型號:

在獲取顯示卡型號時,$gpu_name_temp 是一個陣列,但 $gpu_name 的處理方式可能會導致顯示卡型號顯示不完整。建議檢查 $gpu_name_temp 是否為空陣列,並在顯示時進行適當的處理。

暫停功能:

在程式的最後,使用了 :pause 標籤和 goto pause 來實現暫停功能。這雖然可以讓使用者暫停程式,但可能會導致程式無法正常結束。建議使用 pause 指令來實現暫停功能,並在需要時讓使用者按下任意鍵繼續。

程式結束提示:

最後的提示訊息 Write-Host '如要離開此程式,請直接關閉此視窗....' 是正確的,但可以考慮在顯示完所有資訊後,自動結束程式,而不是讓使用者手動關閉視窗。

以下是修正後的程式碼片段:


@echo off
title Win資訊顯示器(by hone7576)

cls
powershell -command ^
    "Write-Host '歡迎使用 Windows資訊顯示器 v2 重製版 (WMIC轉PowerShell WMI)' -ForegroundColor DarkGreen; " ^
    "Write-Host ''; " ^
    "Write-Host '╔═══════════════════════════════。繼續使用即代表同意下列條款。═══════════════════════════════╗' -ForegroundColor Red; " ^
    "Write-Host '║                                                                                            ║' -ForegroundColor Red; " ^
    "Write-Host '║  1.此程式由hone7576開發,保證安全無毒,而且開源免費,如果您是付費獲得的,就代表您被騙了!  ║' -ForegroundColor Red; " ^
    "Write-Host '║                                                                                            ║' -ForegroundColor Red; " ^
    "Write-Host '║                   2.本人只會將此程式發布到apk.tw論壇,其他來源均為轉載。                   ║' -ForegroundColor Red; " ^
    "Write-Host '║                                                                                            ║' -ForegroundColor Red; " ^
    "Write-Host '║             3.此程式僅供廣大網友們能夠 『更加方便的查看 Windows 的各種資訊』,             ║' -ForegroundColor Red; " ^
    "Write-Host '║                    禁止用於其他用途(例如:盜取他人金鑰),否則後果自負。                    ║' -ForegroundColor Red; " ^
    "Write-Host '║                                                                                            ║' -ForegroundColor Red; " ^
    "Write-Host '║           4.此程式需要使用較新的 Windows 功能,舊版 Windows 可能無法使用此程式。           ║' -ForegroundColor Red; " ^
    "Write-Host '║                                                                                            ║' -ForegroundColor Red; " ^
    "Write-Host '║                           5.除了此條款之外,歡迎盡情修改此程式。                           ║' -ForegroundColor Red; " ^
    "Write-Host '║                                                                                            ║' -ForegroundColor Red; " ^
    "Write-Host '║                      6.如果您未經hone7576許可,禁止修改或刪除此條款。                      ║' -ForegroundColor Red; " ^
    "Write-Host '║                                                                                            ║' -ForegroundColor Red; " ^
    "Write-Host '║                              7.hone7576保留修改此條款之權利。                              ║' -ForegroundColor Red; " ^
    "Write-Host '║                                                                                            ║' -ForegroundColor Red; " ^
    "Write-Host '╚═══════════════════════════════。繼續使用即代表同意上述條款。═══════════════════════════════╝' -ForegroundColor Red; " ^
    "Write-Host ''; " ^
    "Write-Host ''; " ^
    "Write-Host '3秒後可以跳過此頁面。'; " ^
    "Start-Sleep -Seconds 3; " ^
    "Write-Host ''; " ^
    "Write-Host '您可以跳過了,按下任意按鍵以跳過此頁面....' -ForegroundColor DarkGreen; " ^
    "$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown'); " ^
    cls ^
    "Write-Host ''; " ^
    "Write-Host '正在收集 Windows 的資訊....'; " ^
    "try { $product_key = (Get-WmiObject -Query 'SELECT OA3xOriginalProductKey FROM SoftwareLicensingService').OA3xOriginalProductKey } catch { $product_key = $null }; " ^
    "$windows_type = ((Get-WmiObject -Class Win32_OperatingSystem).Caption -replace 'Microsoft ', '').Trim( ); " ^
    "$windows_version = (Get-WmiObject -Class Win32_OperatingSystem).Version; " ^
    "$build_number = (Get-WmiObject -Class Win32_OperatingSystem).BuildNumber; " ^
    "if ([Environment]::Is64BitOperatingSystem) { $os_arch = '64 位元' } else { $os_arch = '32 位元' }; " ^
    "$service_pack = (Get-WmiObject -Class Win32_OperatingSystem).CSDVersion; if ($service_pack) { $service_pack = $service_pack.Trim( ) } else { $service_pack = '無' }; " ^
    "try { $install_date = [Management.ManagementDateTimeConverter]::ToDateTime((Get-WmiObject -Class Win32_OperatingSystem).InstallDate); $install_date_str = '{0}年{1}月{2}日' -f $install_date.Year, $install_date.Month, $install_date.Day } catch { $install_date_str = '(未知)' }; " ^
    "try { $last_boot = [Management.ManagementDateTimeConverter]::ToDateTime((Get-WmiObject -Class Win32_OperatingSystem).LastBootUpTime); $last_boot_str = '{0}年{1}月{2}日' -f $last_boot.Year, $last_boot.Month, $last_boot.Day } catch { $last_boot_str = '(未知)' }; " ^
    "$manufacturer = (Get-WmiObject -Class Win32_ComputerSystem).Manufacturer.Trim( ); " ^
    "$model = (Get-WmiObject -Class Win32_ComputerSystem).Model.Trim( ); " ^
    "$bios_version = (Get-WmiObject -Class Win32_BIOS).SMBIOSBIOSVersion.Trim( ); " ^
    "$cpu_name_temp = (Get-WmiObject -Class Win32_Processor).Name.Trim( ); if (-not $cpu_name_temp) { $cpu_name_temp = '(未知)' }; " ^
    "$cpu_name = [string]::Join('、', $cpu_name_temp); " ^
    "$gpu_name_temp = Get-WmiObject -Class Win32_VideoController | ForEach-Object { $_.Caption.Trim( ) }; " ^
    "$gpu_name = [string]::Join('、', $gpu_name_temp); " ^
    "$ram_size_B = (Get-WmiObject -Class Win32_ComputerSystem).TotalPhysicalMemory; if ($ram_size_B) { $ram_size_GB = [math]::Round($ram_size_B / 1GB, 2) } else { $ram_size_GB = $null }; " ^
    "$country_code = (Get-WmiObject -Class Win32_OperatingSystem).CountryCode; " ^
    cls ^
    "Write-Host ''; " ^
    "Write-Host 'Windows 版本 :' $windows_type; " ^
    "if ($windows_version) { Write-Host 'Windows 詳細版本 :' $windows_version } else { Write-Host 'Windows 詳細版本 :(未知)' }; " ^
    "if ($build_number) { Write-Host '建構號 :' $build_number } else { Write-Host '建構號 : (未知)' }; " ^
    "Write-Host '系統架構 :' $os_arch; " ^
    "if ($country_code) { Write-Host '國家代號 :' $country_code } else { Write-Host '國家代號 : (未知)' }; " ^
    "Write-Host '服務包版本 :' $service_pack; " ^
    "Write-Host ''; " ^
    "if ($product_key) { Write-Host 'Windows 激活金鑰 :' $product_key  -ForegroundColor Blue} else { Write-Host 'Windows 激活金鑰 : 無法偵測到金鑰,您的 Windows 可能尚未激活。' }; " ^
    "Write-Host ''; " ^
    "Write-Host '系統安裝(更新)日期 :' $install_date_str; " ^
    "Write-Host '最近一次的開機時間 :' $last_boot_str; " ^
    "Write-Host ''; " ^
    "Write-Host '處理器型號 :' $cpu_name; " ^
    "if ($gpu_name) { Write-Host '顯示卡型號 :' $gpu_name } else { Write-Host '顯示卡型號 : (未知)' }; " ^
    "if ($ram_size_GB) { Write-Host '記憶體大小 : 大約為'$ram_size_GB' GB (' $ram_size_B 'B)' } else { Write-Host '記憶體大小 : (未知)' }; " ^
    "if ($manufacturer) { Write-Host '系統製造商 :' $manufacturer } else { Write-Host '系統製造商 : 無,您的電腦可能不是套裝機。' }; " ^
    "if ($model) { Write-Host '電腦型號 :' $model } else { Write-Host '電腦型號 : 無,您的電腦可能不是套裝機。' }; " ^
    "if ($bios_version) { Write-Host 'BIOS 版本 :' $bios_version } else { Write-Host 'BIOS 版本 : (未知)' }; " ^
    "Write-Host ''; " ^
    "Write-Host '═════════════════════════════════════════════════════════════════'; " ^
    "Write-Host '網路詳細資訊 :'; " ^
    "Write-Host ''; " ^
    "Get-NetIPConfiguration | ForEach-Object { if ($_.IPv4Address) { Write-Host '網路適配器 :'$_.InterfaceAlias -ForegroundColor Yellow; Write-Host ' IPv4 位址 :'($_.IPv4Address.IPAddress); } if ($_.IPv4DefaultGateway) { Write-Host '  預設閘道 :'$_.IPv4DefaultGateway.NextHop; } Write-Host '' }; " ^
    "Write-Host '═════════════════════════════════════════════════════════════════'; " ^
    "Write-Host ''; " ^
    "Write-Host '如要離開此程式,請直接關閉此視窗....'"

pause

主要修正點:
修正 $cpu_name_temp 的條件判斷。

加入對 $ram_size_B 的檢查。

修正 $gpu_name_temp 的處理方式。

移除不必要的 :pause 標籤和 goto pause,改用 pause 指令。

這些修正應該能夠讓程式更加穩定和易於使用。

Windows資訊顯示器 - 複製.bat

7.71 KB, 下載次數: 3, 下載積分: 碎鑽 -1 個

用Android 就來Android 台灣中文網(https://apk.tw)
回覆 支持 反對

使用道具 舉報

38
matchbox_han | 收聽TA | 只看該作者
發表於 2025-3-3 09:46
這個程式,對我將會是一個很有用的工具,又是完全明碼的bat檔,辛苦你了!!!並致上十二萬分的感謝,我載來看看

評分

參與人數 1碎鑽 +1 幫助 +1 收起 理由
love_apktw + 1 + 1 非常讃

查看全部評分

用Android 就來Android 台灣中文網(https://apk.tw)
回覆 支持 反對

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則