吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 2394|回复: 4
收起左侧

[求助] vbs 重命名文件问题?(已解决)

[复制链接]
幻幻乐 发表于 2019-10-10 13:54
本帖最后由 幻幻乐 于 2019-10-10 16:31 编辑

各位DX好,
                   小的最近噶接触vbs,现在想问下如何使用vbs重命名一个已经存在的文本文件,已经在往上面进行过相关搜索,但是貌似没有找到有类似的案例,或者说大多数都是批量的,才疏学浅,未能从中得到启示,因此在这里求教,谢谢。
以下是我现在收集好在用的bat和vbs的代码:
bat(下面两个vbs都是从这个bat来进行执行):
以下这段代码就是我想求助的,这个Rhea_HardwareInfoCollector.vbs>> \\192.168.98.162\down\Rhea_Result.txt 怎样才能让它输出后已计算机名来自行命名,例如我在A电脑运行以下bat和vbs,最后得到的是A.txt
@if exist Rhea_Result.txt (delRhea_Result.txt)@cscript Rhea_HardwareInfoCollector.vbs >>\\192.168.98.162\down\Rhea_Result.txt
@cscript t-1.vbs
'@echo "结果已打印到Rhea_Result.txt"
'@pause
-----------------------------------------------------------------------------------

Rhea_HardwareInfoCollector.vbs代码(获取电脑硬件信息):
'On Error Resume Next

If WScript.Arguments.Count >= 1 Then
   Select Case WScript.Arguments(0)
       Case "-e", "--execute"
       Case "-v", "--version"
           WScript.Echo "程序版本:1.0.0.0"
           WScript.Echo "作者标识:Tsybius2014"
           WScript.Echo "作者主页:http://my.oschina.net/Tsybius2014/"
           WScript.Echo
           WScript.Quit(0)
       Case "-h", "--help"
           WScript.Echo "进行检查:Rhea_HardwareInfoCollector.vbs[-e|--execute]"
           WScript.Echo "查看帮助:Rhea_HardwareInfoCollector.vbs[-h|--help]"
           WScript.Echo "查看版本:Rhea_HardwareInfoCollector.vbs[-v|--version]"
           WScript.Echo
           WScript.Quit(0)
   End Select
End If

Set WMI =GetObject("Winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")

Dim i, j, k

StartTime = Now

SystemOverview
ProcessorInfo
BaseBoardInfo
MemoryInfo
DiskInfo
GraphicsInfo
DisplayInfo
SoundCardInfo
NetworkCardInfo
KeyBoardInfo
BatteryInfo
PointingDeviceInfo
CDROMDriveInfo
OtherHardware

FinishTime = Now
RunStats

WScript.Echo

'打印标题
Sub SetTitle(TitleName)

   Dim Title : Title = TitleName
   For i = 0 To 9
       Title = "-" & Title & "-"
   Next
   WScript.Echo Title

End Sub

'系统概览
'参考:https://msdn.microsoft.com/en-us/library/aa394102%28VS.85%29.aspx
Sub SystemOverview

   SetTitle "1.系统概览"

   Set Computers = WMI.ExecQuery("Select * fromWin32_ComputerSystem")
   For Each Computer in Computers

       Wscript.Echo "生产厂家:" &Computer.Manufacturer
       Wscript.Echo "当前用户:" &Computer.UserName

   Next

   WScript.Echo

End Sub

'处理器信息
'参考:https://msdn.microsoft.com/en-us/library/aa394373%28VS.85%29.aspx
Sub ProcessorInfo

   SetTitle "2.处理器信息"

   Set CPUs = WMI.InstancesOf("Win32_Processor")
   For Each CPU In CPUs

       WScript.Echo "设备名称: " & CPU.Name
       WScript.Echo "设备描述: " &CPU.Description
       WScript.Echo "设备说明: " &CPU.Caption
       WScript.Echo "处理器标识: " &CPU.ProcessorId

       Dim ProcessorType : ProcessorType = "处理器类型:"
       Select Case CPU.ProcessorType
           Case 1 : ProcessorType = ProcessorType & "Other"
           Case 2 : ProcessorType = ProcessorType & "Unknown"
           Case 3 : ProcessorType = ProcessorType & "CentralProcessor"
           Case 4 : ProcessorType = ProcessorType & "Math Processor"
            Case 5 : ProcessorType =ProcessorType & "DSP Processor"
           Case 6 : ProcessorType = ProcessorType & "Video Processor"
           Case Else : ProcessorType = ProcessorType & "[Type]" &CPU.ProcessorType
       End Select
       WScript.Echo ProcessorType

       WScript.Echo "处理器版本: " &CPU.Version
       'WScript.Echo "唯一标识: " &CPU.UniqueId
       WScript.Echo "设备标识: " &CPU.DeviceID

       Dim Family : Family = "处理器家族:"
       Select Case CPU.Family

           Case 1 : Family =  Family &"Other"
           Case 2 : Family =  Family &"Unknown"
           Case 3 : Family =  Family &"8086"
           Case 4 : Family =  Family &"80286"
           Case 5 : Family =  Family &"Intel386(TM) Processor"
           Case 6 : Family =  Family &"Intel486(TM) Processor"
           Case 7 : Family =  Family &"8087"
           Case 8 : Family =  Family &"80287"
           Case 9 : Family =  Family &"80387"

           Case 10 : Family =  Family &"80487"
           Case 11 : Family =  Family &"Pentium Brand"
           Case 12 : Family =  Family &"Pentium Pro"
           Case 13 : Family =  Family &"Pentium II"
           Case 14 : Family =  Family &"Pentium Processor with MMX(TM) Technology"
           Case 15 : Family =  Family &"Celeron(TM)"
           Case 16 : Family =  Family &"Pentium II Xeon(TM)"
           Case 17 : Family =  Family &"Pentium III"
           Case 18 : Family =  Family &"M1 Family"
           Case 19 : Family =  Family &"M2 Family"

           Case 24 : Family =  Family &"AMD Duron(TM) Processor Family"
           Case 25 : Family =  Family &"K5 Family"
           Case 26 : Family =  Family &"K6 Family"
           Case 27 : Family =  Family &"K6-2"
           Case 28 : Family =  Family &"K6-3"
           Case 29 : Family =  Family &"AMD Athlon(TM) Processor Family"

           Case 30 : Family =  Family &"AMD2900 Family"
           Case 31 : Family =  Family &"K6-2+"
           Case 32 : Family =  Family &"Power PC Family"
           Case 33 : Family =  Family &"Power PC 601"
           Case 34 : Family =  Family &"Power PC 603"
           Case 35 : Family =  Family &"Power PC 603+"
           Case 36 : Family =  Family &"Power PC 604"
           Case 37 : Family =  Family &"Power PC 620"
           Case 38 : Family =  Family &"Power PC X704"
           Case 39 : Family =  Family & "Power PC 750"

           Case 48 : Family =  Family &"Alpha Family"
           Case 49 : Family =  Family &"Alpha 21064"
           Case 50 : Family =  Family &"Alpha 21066"
           Case 51 : Family =  Family &"Alpha 21164"
           Case 52 : Family =  Family &"Alpha 21164PC"
           Case 53 : Family =  Family &"Alpha 21164a"
           Case 54 : Family =  Family &"Alpha 21264"
           Case 55 : Family =  Family &"Alpha 21364"

           Case 64 : Family =  Family &"MIPS Family"
           Case 65 : Family =  Family &"MIPS R4000"
           Case 66 : Family =  Family &"MIPS R4200"
           Case 67 : Family =  Family &"MIPS R4400"
           Case 68 : Family =  Family &"MIPS R4600"
           Case 69 : Family =  Family &"MIPS R10000"

           Case 80 : Family =  Family &"SPARC Family"
           Case 81 : Family =  Family &"SuperSPARC"
           Case 82 : Family =  Family &"microSPARC II"
           Case 83 : Family =  Family &"microSPARC IIep"
           Case 84 : Family =  Family &"UltraSPARC"
           Case 85 : Family =  Family &"UltraSPARC II"
           Case 86 : Family =  Family &"UltraSPARC IIi"
           Case 87 : Family =  Family &"UltraSPARC III"
           Case 88 : Family =  Family &"UltraSPARC IIIi"

           Case 96 : Family =  Family &"68040"
           Case 97 : Family =  Family &"68xxx Family"
           Case 98 : Family =  Family &"68000"
           Case 99 : Family =  Family &"68010"

           Case 100 : Family =  Family &"68020"
           Case 101 : Family =  Family &"68030"
           Case 112 : Family =  Family &"Hobbit Family"
           Case 120 : Family =  Family &"Crusoe(TM) TM5000 Family"
           Case 121 : Family =  Family &"Crusoe(TM) TM3000 Family"
           Case 122 : Family =  Family &"Efficeon(TM) TM8000 Family"
           Case 128 : Family =  Family &"Weitek"

           Case 130 : Family =  Family &"Itanium(TM) Processor"
           Case 131 : Family =  Family &"AMD Athlon(TM) 64 Processor Family"
           Case 132 : Family =  Family &"AMD Opteron(TM) Processor Family"
           Case 144 : Family =  Family &"PA-RISC Family"
           Case 145 : Family =  Family &"PA-RISC 8500"
           Case 146 : Family =  Family &"PA-RISC 8000"
           Case 147 : Family =  Family &"PA-RISC 7300LC"
           Case 148 : Family =  Family &"PA-RISC 7200"
           Case 149 : Family =  Family &"PA-RISC 7100LC"
           Case 150 : Family =  Family &"PA-RISC 7100"
           Case 160 : Family =  Family &"V30 Family"

           Case 176 : Family =  Family &"Pentium III Xeon(TM) Processor"
           Case 177 : Family =  Family &"Pentium III Processor with Intel SpeedStep(TM) Technology"
           Case 178 : Family =  Family &"Pentium 4"
           Case 179 : Family =  Family &"Intel Xeon(TM)"
           Case 180 : Family =  Family &"AS400 Family"
           Case 181 : Family =  Family &"Intel Xeon(TM) Processor MP"
           Case 182 : Family =  Family &"AMD Athlon(TM) XP Family"
           Case 183 : Family =  Family &"AMD Athlon(TM) MP Family"
           Case 184 : Family =  Family &"Intel Itanium 2"
           Case 185 : Family =  Family &"Intel Pentium M Processor"
           Case 190 : Family =  Family &"K7"
           Case 198 : Family =  Family &"Intel Core(TM) i7-2760QM"

           Case 200 : Family =  Family &"IBM390 Family"
           Case 201 : Family =  Family &"G4"
           Case 202 : Family =  Family &"G5"
           Case 203 : Family =  Family &"G6"
           Case 204 : Family =  Family &"z/Architecture Base"
           Case 250 : Family =  Family &"i860"
           Case 251 : Family =  Family &"i960"
           Case 260 : Family =  Family &"SH-3"
           Case 261 : Family =  Family &"SH-4"
           Case 280 : Family =  Family &"ARM"
           Case 281 : Family =  Family &"StrongARM"

           Case 300 : Family =  Family &"6x86"
           Case 301 : Family =  Family &"MediaGX"
           Case 302 : Family =  Family &"MII"
           Case 320 : Family =  Family &"WinChip"
           Case 350 : Family =  Family &"DSP"
           Case 500 : Family =  Family &"Video Processor"
           Case Else : Family = Family & "[Family Type] " &CPU.Family
       End Select
       WScript.Echo Family

       Dim Architecture : Architecture = "处理器架构:"
       Select Case CPU.Architecture
           Case 0 : Architecture = Architecture & "x86"
           Case 1 : Architecture = Architecture & "MIPS"
           Case 2 : Architecture = Architecture & "Alpha"
           Case 3 : Architecture = Architecture & "PowerPC"
           Case 5 : Architecture = Architecture & "ARM"
           Case 6 : Architecture = Architecture & "Itanium-basedsystems"
           Case 9 : Architecture = Architecture & "x64"
           Case Else : Architecture = Architecture & "[Architecture]" & CPU.Architecture
       End Select
       WScript.Echo Architecture

       WScript.Echo "-"

       WScript.Echo "内核数量: " &CPU.NumberOfCores
       WScript.Echo "逻辑处理器数量: " &CPU.NumberOfLogicalProcessors
       WScript.Echo "地址长度: " &CPU.AddressWidth
       WScript.Echo "数据长度: " &CPU.DataWidth
       WScript.Echo "处理速度: " &CPU.CurrentClockSpeed & " MHz"
       WScript.Echo "L2缓存: " &CPU.L2CacheSize & " B"
       WScript.Echo "L3缓存: " &CPU.L3CacheSize & " B"


       WScript.Echo "-"

       Dim CpuStatus : CpuStatus = "处理器状态:"
       Select Case CPU.CpuStatus
           Case 0 : CpuStatus = CpuStatus & "Unknown"
           Case 1 : CpuStatus = CpuStatus & "CPU Enabled"
           Case 2 : CpuStatus = CpuStatus & "CPU Disabled by User via BIOSSetup"
           Case 3 : CpuStatus = CpuStatus & "CPU Disabled by BIOS (POSTError)"
           Case 4 : CpuStatus = CpuStatus & "CPU Is Idle"
           Case 5 : CpuStatus = CpuStatus & "Reserved"
           Case 6 : CpuStatus = CpuStatus & "Reserved"
           Case 7 : CpuStatus = CpuStatus & "Other"
           Case Else : CpuStatus = CpuStatus & "[CpuStatus] " &CPU.CpuStatus
       End Select
       WScript.Echo CpuStatus

       WScript.Echo "="

    Next

   WScript.Echo

End Sub

'主板信息
'参考:https://msdn.microsoft.com/en-us/library/aa394072%28VS.85%29.aspx
Sub BaseBoardInfo

   SetTitle "3.主板信息"

   Set BaseBoards = WMI.InstancesOf("Win32_BaseBoard")
   For Each BaseBoard In BaseBoards

       WScript.Echo "设备名称: " &BaseBoard.Name
       WScript.Echo "设备描述: " &BaseBoard.Description
       WScript.Echo "设备说明: " &BaseBoard.Caption
       WScript.Echo "主板型号: " & BaseBoard.Product
       WScript.Echo "主板版本: " &BaseBoard.Version
       WScript.Echo "制造厂商: " &BaseBoard.Manufacturer
       WScript.Echo "序列号码: " &BaseBoard.SerialNumber

       WScript.Echo "-"

        WScript.Echo "是否底板: " & BaseBoard.HostingBoard
       WScript.Echo "可热插拔: " &BaseBoard.HotSwappable  
       WScript.Echo "是否开启: " &BaseBoard.PoweredOn
       WScript.Echo "可拆卸性: " &BaseBoard.Removable
       WScript.Echo "可替换性: " &BaseBoard.Replaceable

       WScript.Echo "-"

       WScript.Echo "硬件状态: " &BaseBoard.Status

       WScript.Echo "="

   Next

   WScript.Echo

End Sub

'内存信息
'参考:https://msdn.microsoft.com/en-us/library/aa394347%28VS.85%29.aspx
Sub MemoryInfo

   SetTitle "4.内存信息"

   Set Memorys = WMI.InstancesOf("Win32_PhysicalMemory")

   For Each Memory In Memorys

       WScript.Echo "设备名称: " & Memory.Name
       WScript.Echo "设备描述: " &Memory.Description
       WScript.Echo "设备说明: " &Memory.Caption
       WScript.Echo "制造厂商: " &Memory.Manufacturer
       WScript.Echo "序列号码: " &Memory.SerialNumber

       WScript.Echo "-"

       WScript.Echo "数据宽度: " &Memory.DataWidth

       Dim FormFactor : FormFactor = "形状系数:"
       Select Case Memory.FormFactor
           Case 0 : FormFactor = FormFactor & "Unknown"
           Case 1 : FormFactor = FormFactor & "Other"
           Case 2 : FormFactor = FormFactor & "SIP"
           Case 3 : FormFactor = FormFactor & "DIP"
           Case 4 : FormFactor = FormFactor & "ZIP"
           Case 5 : FormFactor = FormFactor & "SOJ"
           Case 6 : FormFactor = FormFactor & "Proprietary"
           Case 7 : FormFactor = FormFactor & "SIMM"
           Case 8 : FormFactor = FormFactor & "DIMM"
           Case 9 : FormFactor = FormFactor & "TSOP"
           Case 10 : FormFactor = FormFactor & "PGA"
           Case 11 : FormFactor = FormFactor & "RIMM"
           Case 12 : FormFactor = FormFactor & "SODIMM"
           Case 13 : FormFactor = FormFactor & "SRIMM"
           Case 14 : FormFactor = FormFactor & "SMD"
           Case 15 : FormFactor = FormFactor & "SSMP"
           Case 16 : FormFactor = FormFactor & "SFP"
           Case 17 : FormFactor = FormFactor & "TQFP"
           Case 18 : FormFactor = FormFactor & "SOIC"
           Case 19 : FormFactor = FormFactor & "LCC"
           Case 20 : FormFactor = FormFactor & "PLCC"
           Case 21 : FormFactor = FormFactor & "BGA"
           Case 22 : FormFactor = FormFactor & "FPBGA"
           Case 23 : FormFactor = FormFactor & "LGA"
           Case Else : FormFactor = FormFactor & "[FormFactor] "& Memory.FormFactor
       End Select
       WScript.Echo FormFactor

       WScript.Echo "容量统计: " &Memory.Capacity / 1024 / 1024 & "MB"

       Dim MemoryType : MemoryType = "内存类型: "
       Select Case Memory.MemoryType
           Case 0 : MemoryType = MemoryType & "Unknown"
           Case 1 : MemoryType = MemoryType & "Other"
           Case 2 : MemoryType = MemoryType & "DRAM"
           Case 3 : MemoryType = MemoryType & "Synchronous DRAM"
           Case 4 : MemoryType = MemoryType & "Cache DRAM"
           Case 5 : MemoryType = MemoryType & "EDO"
            Case 6 : MemoryType = MemoryType& "EDRAM"
           Case 7 : MemoryType = MemoryType & "VRAM"
           Case 8 : MemoryType = MemoryType & "SRAM"
           Case 9 : MemoryType = MemoryType & "RAM"
           Case 10 : MemoryType = MemoryType & "ROM"
           Case 11 : MemoryType = MemoryType & "Flash"
           Case 12 : MemoryType = MemoryType & "EEPROM"
           Case 13 : MemoryType = MemoryType & "FEPROM"
           Case 14 : MemoryType = MemoryType & "EPROM"
           Case 15 : MemoryType = MemoryType & "CDRAM"
           Case 16 : MemoryType = MemoryType & "3DRAM"
           Case 17 : MemoryType = MemoryType & "SDRAM"
           Case 18 : MemoryType = MemoryType & "SGRAM"
           Case 19 : MemoryType = MemoryType & "RDRAM"
           Case 20 : MemoryType = MemoryType & "DDR"
           Case 21 : MemoryType = MemoryType & "DDR-2"
           Case Else : MemoryType = MemoryType & "[MemoryType] "& Memory.MemoryType
       End Select
       WScript.Echo MemoryType

       WScript.Echo "安放位置: " &Memory.DeviceLocator
       WScript.Echo "行中位置: " &Memory.PositionInRow

       WScript.Echo "-"

   Next

   WScript.Echo

End Sub

'硬盘信息
'参考:https://msdn.microsoft.com/en-us/library/aa394132%28VS.85%29.aspx
Sub DiskInfo

   SetTitle "5.硬盘信息"

   Set Disks = WMI.ExecQuery("Select * from Win32_DiskDrive WHEREInterfaceType='IDE'")
   For Each Disk In Disks

       WScript.Echo "设备名称:" & Disk.Name
       WScript.Echo "设备描述: " &Disk.Description
       WScript.Echo "设备说明: " &Disk.Caption
       WScript.Echo "硬盘名称:" &Disk.Caption
       WScript.Echo "生产厂家:" &Disk.Manufacturer
       WScript.Echo "硬盘序列号:" &Disk.SerialNumber
        'WScript.Echo "硬盘签名:" & Disk.Signature

       WScript.Echo "硬盘具有以下能力:"
       For Each Capability In Disk.Capabilities
           Select Case Capability
                Case 0 : WScript.Echo"Unknown"
                Case 1 : WScript.Echo"Other"
                Case 2 : WScript.Echo"Sequential Access"
                Case 3 : WScript.Echo"Random Access"
                Case 4 : WScript.Echo"Supports Writing"
                Case 5 : WScript.Echo"Encryption"
                Case 6 : WScript.Echo"Compression"
                Case 7 : WScript.Echo"Supports Removable Media"
                Case 8 : WScript.Echo"Manual Cleaning"
                Case 9 : WScript.Echo"Automatic Cleaning"
                Case 10 : WScript.Echo"SMART Notification"
                Case 11 : WScript.Echo"Supports Dual-Sided Media"
                Case 12 : WScript.Echo"Ejection Prior to Drive Dismount Not Required"
               Case Else : WScript.Echo"-"
           End Select
       Next

       WScript.Echo "-"

       WScript.Echo "硬盘默认分块大小:" &Disk.DefaultBlockSize
       WScript.Echo "硬盘最大分块大小:" &Disk.MaxBlockSize
       WScript.Echo "硬盘最小分块大小:" &Disk.MinBlockSize
       WScript.Echo "硬盘扇区数:" &Disk.SectorsPerTrack

       WScript.Echo "硬盘柱面数:" &Disk.TotalCylinders
       WScript.Echo "硬盘总头数:" &Disk.TotalHeads
       WScript.Echo "硬盘扇区数:" &Disk.TotalSectors
       WScript.Echo "硬盘总道数:" &Disk.TotalTracks
       WScript.Echo "硬盘总道数:" &Disk.TotalTracks
       WScript.Echo "每柱磁道数:" &Disk.TracksPerCylinder


       WScript.Echo "固件版本:" & Disk.FirmwareRevision
       WScript.Echo "接口类型:" &Disk.InterfaceType

       WScript.Echo "-"

       WScript.Echo "硬盘容量:" &FormatNumber(Disk.Size / 1024 / 1024 / 1024, 3) & " GB"

       WScript.Echo "="

   Next

    WScript.Echo

End Sub

'显卡信息
'参考:https://msdn.microsoft.com/en-us/library/aa394512%28VS.85%29.aspx
Sub GraphicsInfo

   SetTitle "6.显卡信息"

   Set VIDs = WMI.ExecQuery("SELECT DeviceID FROMWin32_VideoController")
   For Each VID In VIDs

       Set Videos = WMI.ExecQuery("SELECT * FROM Win32_VideoControllerWHERE DeviceID='"& VID.DeviceID &"'")
       For Each Video In Videos

           WScript.Echo "设备名称: " & Video.Name
           WScript.Echo "设备描述: " &Video.Description
           WScript.Echo "设备说明: " &Video.Caption
           WScript.Echo "制造厂商: " &Video.AdapterCompatibility

           Dim VideoArchitecture : VideoArchitecture = "视频架构:"
           Select Case Video.VideoArchitecture
                Case 1 : VideoArchitecture =VideoArchitecture & "Other"
                Case 2 : VideoArchitecture =VideoArchitecture & "Unknown"
                Case 3 : VideoArchitecture =VideoArchitecture & "CGA"
                Case 4 : VideoArchitecture =VideoArchitecture & "EGA"
                Case 5 : VideoArchitecture =VideoArchitecture & "VGA"
                Case 6 : VideoArchitecture =VideoArchitecture & "SVGA"
                Case 7 : VideoArchitecture =VideoArchitecture & "MDA"
                Case 8 : VideoArchitecture =VideoArchitecture & "HGC"
                Case 9 : VideoArchitecture =VideoArchitecture & "MCGA"
                Case 10 : VideoArchitecture =VideoArchitecture & "8514A"
                Case 11 : VideoArchitecture =VideoArchitecture & "XGA"
                Case 12 : VideoArchitecture =VideoArchitecture & "Linear Frame Buffer"
                Case 160 : VideoArchitecture =VideoArchitecture & "PC-98"
                Case Else : VideoArchitecture =VideoArchitecture & "[VideoArchitecture] " &Video.VideoArchitecture
           End Select
           WScript.Echo VideoArchitecture

           Dim VideoMemoryType : VideoMemoryType = "视频存储器类型:"
           Select Case Video.VideoMemoryType
                Case 1 : VideoMemoryType =VideoMemoryType & "Other"
                Case 2 : VideoMemoryType =VideoMemoryType & "Unknown"
               Case 3 : VideoMemoryType= VideoMemoryType & "VRAM"
                Case 4 : VideoMemoryType =VideoMemoryType & "DRAM"
                Case 5 : VideoMemoryType =VideoMemoryType & "SRAM"
                Case 6 : VideoMemoryType =VideoMemoryType & "WRAM"
                Case 7 : VideoMemoryType =VideoMemoryType & "EDO RAM"
                Case 8 : VideoMemoryType =VideoMemoryType & "Burst Synchronous DRAM"
                Case 9 : VideoMemoryType =VideoMemoryType & "Pipelined Burst SRAM"
               Case 10 :VideoMemoryType = VideoMemoryType & "CDRAM"
                Case 11 : VideoMemoryType =VideoMemoryType & "3DRAM"
                Case 12 : VideoMemoryType =VideoMemoryType & "SDRAM"
                Case 13 : VideoMemoryType =VideoMemoryType & "SGRAM"
                Case Else : VideoMemoryType =VideoMemoryType & "[VideoMemoryType] " &Video.VideoMemoryType
           End Select
           Wscript.Echo VideoMemoryType

           WScript.Echo "视频处理器: " &Video.VideoProcessor

           WScript.Echo "-"

           WScript.Echo "物理显存: " &Round(Video.AdapterRAM / 1024 / 1024)&" MB"
           WScript.Echo "分辨率: " &Video.CurrentHorizontalResolution & " * " &Video.CurrentVerticalResolution
           WScript.Echo "单位像素比特数:" & Video.CurrentBitsPerPixel & " Bit"
           WScript.Echo "刷新频率: " &Video.CurrentRefreshRate & " Hz"

           WScript.Echo "="

       Next
       Set Videos = Nothing

   Next
   Set VIDs = Nothing

   WScript.Echo

End Sub

'显示器信息
'参考:https://msdn.microsoft.com/en-us/library/aa394122%28VS.85%29.aspx
Sub DisplayInfo

   SetTitle "7.显示器信息"

    '显示器信息
   Set Monitors = WMI.ExecQuery("Select * fromWin32_DesktopMonitor")
   For Each Monitor In Monitors

       WScript.Echo "设备名称: " &Monitor.Name
       WScript.Echo "设备描述: " &Monitor.Description
       WScript.Echo "设备说明: " &Monitor.Caption
       WScript.Echo "显示器类型: " & Monitor.MonitorType
       WScript.Echo "生产厂家: " &Monitor.MonitorManufacturer

       WScript.Echo "-"

       WScript.Echo "屏幕高度: " &Monitor.ScreenHeight
       WScript.Echo "屏幕宽度: " &Monitor.ScreenWidth
       WScript.Echo "X轴每逻辑英寸像素数: " &Monitor.PixelsPerXLogicalInch
       WScript.Echo "Y轴每逻辑英寸像素数: " &Monitor.PixelsPerYLogicalInch

       Dim DisplayType : DisplayType = "显示模式:"
       Select Case Monitor.DisplayType
           Case 0 : DisplayType = DisplayType & "Unknown"
           Case 1 : DisplayType = DisplayType & "Other"
           Case 2 : DisplayType = DisplayType & "Multiscan Color"
           Case 3 : DisplayType = DisplayType & "MultiscanMonochrome"
           Case 4 : DisplayType = DisplayType & "Fixed FrequencyColor"
           Case 5 : DisplayType = DisplayType & "Fixed FrequencyMonochrome"
           Case Else : DisplayType = DisplayType & "[DisplayType] "& Monitor.DisplayType
       End Select
       Wscript.Echo DisplayType

       Dim StatusInfo : StatusInfo = "状态信息:"
       Select Case Monitor.StatusInfo
           Case 1 : StatusInfo = StatusInfo & "Other"
           Case 2 : StatusInfo = StatusInfo & "Unknown"
           Case 3 : StatusInfo = StatusInfo & "Enabled"
           Case 4 : StatusInfo = StatusInfo & "Disabled"
           Case 5 : StatusInfo = StatusInfo & "Not Applicable"
           Case Else : StatusInfo = StatusInfo & "[StatusInfo] "& Monitor.StatusInfo
       End Select
       Wscript.Echo StatusInfo

       WScript.Echo "="

   Next

   WScript.Echo

End Sub

'声卡信息
'参考:https://msdn.microsoft.com/en-us/library/aa394463%28VS.85%29.aspx
Sub SoundCardInfo

   SetTitle "8.声卡信息"

    '声卡信息
   Set SoundDevices = WMI.ExecQuery("SELECT * FROMWin32_SoundDevice")
   For Each SoundDevice In SoundDevices

       WScript.Echo "设备名称: " &SoundDevice.Name
       WScript.Echo "设备描述: " &SoundDevice.Description
       WScript.Echo "设备说明: " &SoundDevice.Caption
       WScript.Echo "制造厂商: " &SoundDevice.Manufacturer

       Dim StatusInfo : StatusInfo = "状态信息:"
       Select Case SoundDevice.StatusInfo
           Case 1 : StatusInfo = StatusInfo & "Other"
           Case 2 : StatusInfo = StatusInfo & "Unknown"
           Case 3 : StatusInfo = StatusInfo & "Enabled"
           Case 4 : StatusInfo = StatusInfo & "Disabled"
           Case 5 : StatusInfo = StatusInfo & "Not Applicable"
           Case Else : StatusInfo = StatusInfo & "[StatusInfo] "& SoundDevice.StatusInfo
       End Select
       Wscript.Echo StatusInfo

       WScript.Echo "="

   Next
   Set SoundDevices = Nothing

   WScript.Echo

End Sub

'网卡信息
'参考:https://msdn.microsoft.com/en-us/library/aa394216%28v=vs.85%29.aspx
Sub NetworkCardInfo

   SetTitle "9.网卡信息"

    '网卡信息
   Set Networks = WMI.ExecQuery("Select * from Win32_NetworkAdapterWHERE PhysicalAdapter ='TRUE'")
    For Each Network In Networks

       WScript.Echo "设备名称: " &Network.Name
       WScript.Echo "设备描述: " &Network.Description
       WScript.Echo "设备说明: " &Network.Caption
       WScript.Echo "适配器型号: " &Network.AdapterType
       WScript.Echo "生产厂商: " &Network.Manufacturer
       WScript.Echo "设备标识: " &Network.DeviceID

       WScript.Echo "GUID: "& Network.GUID
       WScript.Echo "MAC: "& Network.MACAddress

       WScript.Echo "-"

       If Network.NetEnabled = TRUE Then
           WScript.Echo "活跃状态:" & "活跃"
       Else
           WScript.Echo "活跃状态:" & "空闲"
       End If

       Dim NetConnectionStatus : NetConnectionStatus = "状态信息:"
       Select Case Network.NetConnectionStatus
           Case 0 : NetConnectionStatus = NetConnectionStatus &"Disconnected"
           Case 1 : NetConnectionStatus = NetConnectionStatus &"Connecting"
           Case 2 : NetConnectionStatus = NetConnectionStatus &"Connected"
            Case 3 : NetConnectionStatus =NetConnectionStatus & "Disconnecting"
           Case 4 : NetConnectionStatus = NetConnectionStatus & "Hardwarenot present"
           Case 5 : NetConnectionStatus = NetConnectionStatus & "Hardwaredisabled"
           Case 6 : NetConnectionStatus= NetConnectionStatus & "Hardware malfunction"
           Case 7 : NetConnectionStatus = NetConnectionStatus & "Mediadisconnected"
           Case 8 : NetConnectionStatus = NetConnectionStatus &"Authenticating"
           Case 9 : NetConnectionStatus= NetConnectionStatus & "Authentication succeeded"
           Case 10 : NetConnectionStatus = NetConnectionStatus &"Authentication failed"
           Case 11 : NetConnectionStatus = NetConnectionStatus & "InvalIDAddress"
           Case 12 : NetConnectionStatus = NetConnectionStatus &"Credentials required"
           Case Else : NetConnectionStatus = NetConnectionStatus &"[NetConnectionStatus] " & Network.NetConnectionStatus
       End Select
       Wscript.Echo NetConnectionStatus

       WScript.Echo "="

   Next
   Set cNet = Nothing

   WScript.Echo

End Sub

'键盘信息
'参考:https://msdn.microsoft.com/en-us/library/aa394166%28v=vs.85%29.aspx
Sub KeyBoardInfo

   SetTitle "10.键盘信息"

   Set Keyboards = WMI.ExecQuery("Select * from Win32_Keyboard")
   For Each Keyboard In Keyboards

       WScript.Echo "设备名称: " &Keyboard.Name
       WScript.Echo "设备描述: " &Keyboard.Description  
       WScript.Echo "设备说明: " &Keyboard.Caption
       WScript.Echo "功能键数量: " &Keyboard.NumberOfFunctionKeys

   Next

   WScript.Echo

End Sub

'电池信息
Sub BatteryInfo

   SetTitle "11.电池信息"

   Set Batterys = WMI.ExecQuery("Select * from Win32_Battery")
   For Each Battery In Batterys

       WScript.Echo "设备名称: "&Battery.Name
       WScript.Echo "设备描述: "&Battery.Description
       WScript.Echo "设备说明: " &Battery.Caption  

       Dim Chemistry : Chemistry = "电池类型:"
       Select Case Battery.Chemistry
           Case 1 : Chemistry = Chemistry & "Other"
           Case 2 : Chemistry = Chemistry & "Unknown"
           Case 3 : Chemistry = Chemistry & "Lead Acid"
            Case 4 : Chemistry = Chemistry &"Nickel Cadmium"
           Case 5 : Chemistry = Chemistry & "Nickel Metal Hydride"
           Case 6 : Chemistry = Chemistry & "Lithium-ion"
           Case 7 : Chemistry = Chemistry & "Zinc air"
           Case 8 : Chemistry = Chemistry & "Lithium Polymer"
           Case Else : Chemistry = Chemistry & "[Chemistry] " &Battery.Chemistry
       End Select
       WScript.Echo Chemistry

       WScript.Echo "设计容量: " &Battery.DesignCapacity & " milliwatt-hour(s)"
       WScript.Echo "设计电压: " &Battery.DesignVoltage & " millivolt(s)"
   Next

   WScript.Echo

End Sub


'指示设备信息
'参考:https://msdn.microsoft.com/en-us/library/aa394356.aspx
Sub PointingDeviceInfo

   SetTitle "12.指示设备信息"

   Set PointingDevices = WMI.ExecQuery("Select * fromWin32_PointingDevice")
   For Each PointingDevice In PointingDevices

       WScript.Echo "设备名称: "& PointingDevice.Name
       WScript.Echo "设备描述: "&PointingDevice.Description
       WScript.Echo "设备说明: " &PointingDevice.Caption  
       WScript.Echo "生产厂家: " &PointingDevice.Manufacturer  

       Dim DeviceInterface : DeviceInterface = ""
       Select Case PointingDevice.DeviceInterface
           Case 1 : DeviceInterface = DeviceInterface & "Other"
           Case 2 : DeviceInterface = DeviceInterface & "Unknown"
           Case 3 : DeviceInterface = DeviceInterface & "Serial"
           Case 4 : DeviceInterface = DeviceInterface & "PS/2"
           Case 5 : DeviceInterface = DeviceInterface & "Infrared"
           Case 6 : DeviceInterface = DeviceInterface & "HP-HIL"
           Case 7 : DeviceInterface = DeviceInterface & "Bus Mouse"
           Case 8 : DeviceInterface = DeviceInterface & "ADB (AppleDesktop Bus)"
           Case 160 : DeviceInterface = DeviceInterface & "Bus MouseDB-9"
           Case 161 : DeviceInterface = DeviceInterface & "Bus MouseMicro-DIN"
           Case 162 : DeviceInterface = DeviceInterface & "USB"
           Case Else : DeviceInterface = DeviceInterface & "[DeviceInterface]" & PointingDevice.DeviceInterface
       End Select
       WScript.Echo DeviceInterface

       WScript.Echo "硬件类型: " &PointingDevice.HardwareType

       WScript.Echo "="

   Next

   WScript.Echo

End Sub

'光驱设备
'参考:https://msdn.microsoft.com/en-us/library/aa394081.aspx
Sub CDROMDriveInfo

   SetTitle "13.光驱设备"

   Set CDROMDrives = WMI.ExecQuery("Select * fromWin32_CDROMDrive")
   For Each CDROMDrive In CDROMDrives

       WScript.Echo "设备名称: "&CDROMDrive.Name
       WScript.Echo "设备描述: "&CDROMDrive.Description
       WScript.Echo "设备说明: " &CDROMDrive.Caption  
       WScript.Echo "生产厂家: " &CDROMDrive.Manufacturer

       WScript.Echo "="

   Next

   WScript.Echo

End Sub

'其他硬件
Sub OtherHardware

   'SetTitle "其他信息"

   'WScript.Echo

End Sub

'运行统计
Sub RunStats

   SetTitle "运行统计"

   WScript.Echo "检查开始时间:" & StartTime
   WScript.Echo "检查结束时间:" &FinishTime
   WScript.Echo "检查用时:" &DateDiff("s", StartTime, FinishTime) & " 秒"

   WScript.Echo

End Sub
------------------------------------------------------------------------------------------------------------
弹框vbs代码:
Dim department,name,display
department=InputBox("请输入部门")
name=InputBox("请输入姓名")
display=InputBox("请输入显示器")
Setfso=CreateObject("scripting.filesystemobject")
Setfi=fso.opentextfile("D:\down\Rhea_Result.txt",8)
s="部门:"&department&vbCrLf&"姓名:"&name&vbCrLf&"显示器:"&display
fi.write s
fi.Close

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

bachelor66 发表于 2019-10-10 16:25
>>\\192.168.98.162\down\%computername%.txt
不行吗?

免费评分

参与人数 1吾爱币 +1 热心值 +1 收起 理由
幻幻乐 + 1 + 1 我很赞同!

查看全部评分

hkmoge 发表于 2019-10-10 16:30
代码这么长,还不如用bat,几行代码就搞定了。
 楼主| 幻幻乐 发表于 2019-10-10 16:30
 楼主| 幻幻乐 发表于 2019-10-10 16:38
hkmoge 发表于 2019-10-10 16:30
代码这么长,还不如用bat,几行代码就搞定了。

多谢您的回答,能否指导一下,我现在一个bat,几个vbs,还在找如何打包呢?如果一个bat能搞掂的话就最好了。
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-27 00:35

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表