獲取電腦配置bat

2021-09-24 23:56:20 字數 4090 閱讀 2783

@echo off

color 0a

title 硬體檢測

mode con cols=90

sc config winmgmt start= auto >nul 2<&1

net start winmgmt 2>1nul

setlocal enabledelayedexpansion

echo 主版:

for /f "tokens=1,* delims==" %%a in ('wmic baseboard get manufacturer^,product^,version^,serialnumber /value') do (

set /a tee+=1

if "!tee!" == "3" echo 製造商 = %%b

if "!tee!" == "4" echo 型 號 = %%b

if "!tee!" == "5" echo 序列號 = %%b

if "!tee!" == "6" echo 版 本 = %%b

)set tee=0

echo bios:

for /f "tokens=1,* delims==" %%a in ('wmic bios get

currentlanguage^,manufacturer^,smbiosbiosversion^,smbiosmajorversion^,smbiosminorversion^,releasedate /value') do (

set /a tee+=1

if "!tee!" == "3" echo 當前語言 = %%b

if "!tee!" == "4" echo 製造商 = %%b

if "!tee!" == "5" echo 發行日期 = %%b

if "!tee!" == "6" echo 版 本 = %%b

if "!tee!" == "7" echo smbiosmajorversion = %%b

if "!tee!" == "8" echo smbiosminorversion = %%b

)set tee=0

echo.

echo cpu:

for /f "tokens=1,* delims==" %%a in ('wmic cpu get name^,extclock^,cpustatus^,description /value') do (

set /a tee+=1

if "!tee!" == "3" echo cpu個數 = %%b

if "!tee!" == "4" echo 處理器版本 = %%b

if "!tee!" == "5" echo 外 頻 = %%b

if "!tee!" == "6" echo 名稱及主頻率 = %%b

)set tee=0

echo.

echo 顯示器:

for /f "tokens=1,* delims==" %%a in ('wmic desktopmonitor get name^,screenwidth^,screenheight^,pnpdeviceid /value') do (

set /a tee+=1

if "!tee!" == "3" echo 類 型 = %%b

if "!tee!" == "4" echo 其他資訊 = %%b

if "!tee!" == "5" echo 螢幕高 = %%b

if "!tee!" == "6" echo 螢幕寬 = %%b

)set tee=0

echo.

echo 硬 盤:

for /f "tokens=1,* delims==" %%a in ('wmic diskdrive get model^,inte***cetype^,size^,totalsectors^,partitions /value') do (

set /a tee+=1

if "!tee!" == "3" echo 介面型別 = %%b

if "!tee!" == "4" echo 硬碟型號 = %%b

if "!tee!" == "5" echo 分割槽數 = %%b

if "!tee!" == "6" echo 容 量 = %%b

if "!tee!" == "7" echo 總扇區 = %%b

)echo 分割槽資訊:

wmic logicaldisk where mediatype='12' get description,deviceid,filesystem,size,freespace

set tee=0

echo.

echo 網 卡:

for /f "tokens=1,* delims==" %%a in ('wmic nicconfig where "index='1'" get ipaddress^,macaddress^,description /value') do (

set /a tee+=1

if "!tee!" == "3" echo 網絡卡型別 = %%b

if "!tee!" == "4" echo 網絡卡ip = %%b

if "!tee!" == "5" echo 網絡卡mac = %%b

)set tee=0

echo.

echo 印表機:

for /f "tokens=1,* delims==" %%a in ('wmic printer get caption /value') do (

set /a tee+=1

if "!tee!" == "3" echo 印表機名字 = %%b

)set tee=0

echo.

echo 聲 卡:

for /f "tokens=1,* delims==" %%a in ('wmic sounddev get name^,deviceid /value') do (

set /a tee+=1

if "!tee!" == "3" echo 其他資訊 = %%b

if "!tee!" == "4" echo 型 號 = %%b

)set tee=0

echo.

echo 內 存:

for /f "tokens=1,* delims==" %%a in ('systeminfo^|find "記憶體"') do (

echo %%a 4534 %%b

)echo.

echo 顯 卡:

del /f "%temp%\temp.txt" 2>nul

dxdiag /t %temp%\temp.txt

:顯示卡rem 這裡需要30秒左右!

if exist "%temp%\temp.txt" (

for /f "tokens=1,2,* delims=:" %%a in ('findstr /c:" card name:" /c:"display memory:" /c:"current mode:" "%temp%\temp.txt"') do (

set /a tee+=1

if !tee! == 1 echo 顯示卡型號: %%b

if !tee! == 2 echo 視訊記憶體大小: %%b

if !tee! == 3 echo 當前設定: %%b

) ) else (

ping /n 2 127.1>nul

goto 顯示卡

)set /p var=需要額外資訊嗎(y/n):

if /i %var% == y notepad "%temp%\temp.txt"

del /f "%temp%\temp.txt" 2>nul

pause

清除電腦快取的bat檔案

電腦在使用了之後,會產生垃圾快取,若不及時清理會降低電腦的執行速度。1 步驟 2 新建乙個記事本檔案,命名 系統清理 或其他名字 3 原封不動複製下面的文字到該記事本中 echo off echo 正在清除系統垃圾檔案,請稍等.del f s q systemdrive tmp del f s q ...

C 獲取電腦硬體配置資訊

using system using system.management using system.collections using system.collections.specialized using system.text namespace rainsoft.management end...

bat檔案獲取當前目錄

win10 上 cd d dp0 切換到當前bat檔案所在目錄 原文 知道windows的bat指令碼很強大,但是具體命令向來很少接觸,今天在win7上執行自己以前寫的乙個安裝mysql資料庫到系統服務的指令碼時,遇到一些問題,下面記錄一下。問題 mysql服務安裝指令碼在win7下執行失敗 原因 ...