[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[特效代码] 请教,怎么将批处理结果保存到文件。

请教,怎么将批处理结果保存到文件,文件名以电脑名字。(如:\\192.168.1.2\jim.txt)  感谢,,,,,感谢!!!
批处理如下:
  1. @echo off
  2. color 0a
  3. title    硬件检测      
  4. mode con cols=90
  5. sc config  winmgmt start= auto >nul 2<&1
  6. net start winmgmt 2>1nul
  7. setlocal  ENABLEDELAYEDEXPANSION
  8. echo 主版:
  9. for /f "tokens=1,* delims==" %%a in ('wmic BASEBOARD get Manufacturer^,Product^,Version^,SerialNumber /value') do (
  10.      set /a tee+=1
  11.      if "!tee!" == "3" echo       制造商   = %%b
  12.      if "!tee!" == "4" echo       型  号   = %%b
  13.      if "!tee!" == "5" echo       序列号   = %%b
  14.      if "!tee!" == "6" echo       版  本   = %%b
  15. )
  16. set tee=0
  17. echo      BIOS:
  18. for /f "tokens=1,* delims==" %%a in ('wmic bios  get
  19. CurrentLanguage^,Manufacturer^,SMBIOSBIOSVersion^,SMBIOSMajorVersion^,SMBIOSMinorVersion^,ReleaseDate /value') do (
  20.      set /a tee+=1
  21.      if "!tee!" == "3" echo       当前语言 = %%b
  22.      if "!tee!" == "4" echo       制造商   = %%b
  23.      if "!tee!" == "5" echo       发行日期 = %%b
  24.      if "!tee!" == "6" echo       版  本   = %%b
  25.      if "!tee!" == "7" echo       SMBIOSMajorVersion = %%b
  26.      if "!tee!" == "8" echo       SMBIOSMinorVersion = %%b
  27. )
  28. set tee=0
  29. echo.
  30. echo CPU:
  31. for /f "tokens=1,* delims==" %%a in ('wmic cpu get name^,ExtClock^,CpuStatus^,Description /value') do (
  32.      set /a tee+=1
  33.      if "!tee!" == "3" echo       CPU个数   = %%b
  34.      if "!tee!" == "4" echo       处理器版本   = %%b
  35.      if "!tee!" == "5" echo       外   频   = %%b
  36.      if "!tee!" == "6" echo       名称及主频率   = %%b
  37. )
  38. set tee=0
  39. echo.
  40. echo 显示器:
  41. for /f "tokens=1,* delims==" %%a in ('wmic DESKTOPMONITOR  get name^,ScreenWidth^,ScreenHeight^,PNPDeviceID /value') do (
  42.      set /a tee+=1
  43.      if "!tee!" == "3" echo       类    型  = %%b
  44.      if "!tee!" == "4" echo       其他信息  = %%b
  45.      if "!tee!" == "5" echo       屏幕高    = %%b
  46.      if "!tee!" == "6" echo       屏幕宽    = %%b
  47. )
  48. set tee=0
  49. echo.
  50. echo 硬  盘:
  51. for /f "tokens=1,* delims==" %%a in ('wmic DISKDRIVE get model^,interfacetype^,size^,totalsectors^,partitions /value') do (
  52.      set /a tee+=1
  53.      if "!tee!" == "3" echo       接口类型  = %%b
  54.      if "!tee!" == "4" echo       硬盘型号  = %%b
  55.      if "!tee!" == "5" echo       分区数    = %%b
  56.      if "!tee!" == "6" echo       容    量  = %%b
  57.      if "!tee!" == "7" echo       总扇区    = %%b
  58. )
  59. echo 分区信息:
  60. wmic LOGICALDISK  where mediatype='12' get description,deviceid,filesystem,size,freespace
  61. set tee=0
  62. echo.
  63. echo 网  卡:
  64. for /f "tokens=1,* delims==" %%a in ('wmic NICCONFIG where "index='1'" get ipaddress^,macaddress^,description /value') do (
  65.      set /a tee+=1
  66.      if "!tee!" == "3" echo       网卡类型  = %%b
  67.      if "!tee!" == "4" echo       网卡IP    = %%b
  68.      if "!tee!" == "5" echo       网卡MAC   = %%b
  69. )
  70. set tee=0
  71. echo.
  72. echo 打印机:
  73. for /f "tokens=1,* delims==" %%a in ('wmic PRINTER get caption /value') do (
  74.      set /a tee+=1
  75.      if "!tee!" == "3" echo       打印机名字  = %%b
  76. )
  77. set tee=0
  78. echo.
  79. echo 声   卡:
  80. for /f "tokens=1,* delims==" %%a in ('wmic SOUNDDEV get name^,deviceid /value') do (
  81.      set /a tee+=1
  82.      if "!tee!" == "3" echo       其他信息  = %%b
  83.      if "!tee!" == "4" echo       型    号  = %%b
  84. )
  85. set tee=0
  86. echo.
  87. echo 内    存:
  88. for /f "tokens=1,* delims==" %%a in ('systeminfo^|find "内存"') do (
  89.     echo         %%a 4534 %%b
  90. )
  91. echo.
  92. echo 显    卡:
  93. del /f "%TEMP%\temp.txt" 2>nul
  94. dxdiag /t %TEMP%\temp.txt
  95. :显卡
  96. rem 这里需要30秒左右!
  97. if EXIST "%TEMP%\temp.txt" (
  98.     for /f "tokens=1,2,* delims=:" %%a in ('findstr /c:" Card name:" /c:"Display Memory:" /c:"Current Mode:" "%TEMP%\temp.txt"') do (
  99.          set /a tee+=1
  100.          if !tee! == 1 echo     显卡型号: %%b
  101.          if !tee! == 2 echo     显存大小: %%b
  102.          if !tee! == 3 echo     当前设置: %%b
  103. )   ) else (
  104.     ping /n 2 127.1>nul
  105.     goto 显卡
  106. )
  107. pause
复制代码

  1. del 1.txt >nul 2>nul
  2. (@echo off
  3. color 0a
  4. title    硬件检测      
  5. mode con cols=90
  6. sc config  winmgmt start= auto >nul 2<&1
  7. net start winmgmt 2>1nul
  8. setlocal  ENABLEDELAYEDEXPANSION
  9. echo 主版:
  10. for /f "tokens=1,* delims==" %%a in ('wmic BASEBOARD get Manufacturer^,Product^,Version^,SerialNumber
  11. /value') do (
  12.      set /a tee+=1
  13.      if "!tee!" == "3" echo       制造商   = %%b
  14.      if "!tee!" == "4" echo       型  号   = %%b
  15.      if "!tee!" == "5" echo       序列号   = %%b
  16.      if "!tee!" == "6" echo       版  本   = %%b
  17. )
  18. set tee=0
  19. echo      BIOS:
  20. for /f "tokens=1,* delims==" %%a in ('wmic bios  get
  21. CurrentLanguage^,Manufacturer^,SMBIOSBIOSVersion^,SMBIOSMajorVersion^,SMBIOSMinorVersion^,ReleaseDate
  22. /value') do (
  23.      set /a tee+=1
  24.      if "!tee!" == "3" echo       当前语言 = %%b
  25.      if "!tee!" == "4" echo       制造商   = %%b
  26.      if "!tee!" == "5" echo       发行日期 = %%b
  27.      if "!tee!" == "6" echo       版  本   = %%b
  28.      if "!tee!" == "7" echo       SMBIOSMajorVersion = %%b
  29.      if "!tee!" == "8" echo       SMBIOSMinorVersion = %%b
  30. )
  31. set tee=0
  32. echo.
  33. echo CPU:
  34. for /f "tokens=1,* delims==" %%a in ('wmic cpu get name^,ExtClock^,CpuStatus^,Description /value') do (
  35.      set /a tee+=1
  36.      if "!tee!" == "3" echo       CPU个数   = %%b
  37.      if "!tee!" == "4" echo       处理器版本   = %%b
  38.      if "!tee!" == "5" echo       外   频   = %%b
  39.      if "!tee!" == "6" echo       名称及主频率   = %%b
  40. )
  41. set tee=0
  42. echo.
  43. echo 显示器:
  44. for /f "tokens=1,* delims==" %%a in ('wmic DESKTOPMONITOR  get
  45. name^,ScreenWidth^,ScreenHeight^,PNPDeviceID /value') do (
  46.      set /a tee+=1
  47.      if "!tee!" == "3" echo       类    型  = %%b
  48.      if "!tee!" == "4" echo       其他信息  = %%b
  49.      if "!tee!" == "5" echo       屏幕高    = %%b
  50.      if "!tee!" == "6" echo       屏幕宽    = %%b
  51. )
  52. set tee=0
  53. echo.
  54. echo 硬  盘:
  55. for /f "tokens=1,* delims==" %%a in ('wmic DISKDRIVE get
  56. model^,interfacetype^,size^,totalsectors^,partitions /value') do (
  57.      set /a tee+=1
  58.      if "!tee!" == "3" echo       接口类型  = %%b
  59.      if "!tee!" == "4" echo       硬盘型号  = %%b
  60.      if "!tee!" == "5" echo       分区数    = %%b
  61.      if "!tee!" == "6" echo       容    量  = %%b
  62.      if "!tee!" == "7" echo       总扇区    = %%b
  63. )
  64. echo 分区信息:
  65. wmic LOGICALDISK  where mediatype='12' get description,deviceid,filesystem,size,freespace
  66. set tee=0
  67. echo.
  68. echo 网  卡:
  69. for /f "tokens=1,* delims==" %%a in ('wmic NICCONFIG where "index='1'" get
  70. ipaddress^,macaddress^,description /value') do (
  71.      set /a tee+=1
  72.      if "!tee!" == "3" echo       网卡类型  = %%b
  73.      if "!tee!" == "4" echo       网卡IP    = %%b
  74.      if "!tee!" == "5" echo       网卡MAC   = %%b
  75. )
  76. set tee=0
  77. echo.
  78. echo 打印机:
  79. for /f "tokens=1,* delims==" %%a in ('wmic PRINTER get caption /value') do (
  80.      set /a tee+=1
  81.      if "!tee!" == "3" echo       打印机名字  = %%b
  82. )
  83. set tee=0
  84. echo.
  85. echo 声   卡:
  86. for /f "tokens=1,* delims==" %%a in ('wmic SOUNDDEV get name^,deviceid /value') do (
  87.      set /a tee+=1
  88.      if "!tee!" == "3" echo       其他信息  = %%b
  89.      if "!tee!" == "4" echo       型    号  = %%b
  90. )
  91. set tee=0
  92. echo.
  93. echo 内    存:
  94. for /f "tokens=1,* delims==" %%a in ('systeminfo^|find "内存"') do (
  95.     echo         %%a 4534 %%b
  96. )
  97. echo.
  98. echo 显    卡:
  99. del /f "%TEMP%\temp.txt" 2>nul
  100. dxdiag /t %TEMP%\temp.txt
  101. :显卡
  102. rem 这里需要30秒左右!
  103. if EXIST "%TEMP%\temp.txt" (
  104.     for /f "tokens=1,2,* delims=:" %%a in ('findstr /c:" Card name:" /c:"Display Memory:" /c:"Current
  105. Mode:" "%TEMP%\temp.txt"') do (
  106.          set /a tee+=1
  107.          if !tee! == 1 echo     显卡型号: %%b
  108.          if !tee! == 2 echo     显存大小: %%b
  109.          if !tee! == 3 echo     当前设置: %%b
  110. )   ) else (
  111.     ping /n 2 127.1>nul
  112.     goto 显卡
  113. )
  114. )>>1.txt
  115. ren 1.txt %computername%.txt
  116. pause
复制代码

TOP

返回列表