Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: batch file for wmic command

12 Oct 2018   #1

windows 7 pro 64-bit
batch file for wmic command

Hello all,

I am trying to run a bat file where I can scan all computers within my network by making a list of computer names and collecting information about them. below is what I have so far, however I am not sure how to do it for multiple machines

@echo off
setlocal enabledelayedexpansion
if exist C:\dell\%computername%.csv del C:\dell\%computername%.csv"
set outputfile="C:\dell\%computername%.csv"


wmic Cpu get Name>>%outputfile%

wmic path win32_VideoController get name>>%outputfile%

wmic ComputerSystem get TotalPhysicalMemory>>%outputfile%

WMIC LOGICALDISK where drivetype=3 get caption,size,FreeSpace>%~n0.tmp

for /f "tokens=1-3 skip=1" %%a in ('type "%~n0.tmp"') do call :displayinfo %%a %%b %%c
exit /b

set drive=%1
set free=%2
set total=%3

call :convertbytes total
call :convertbytes free

echo %drive% Total: %total%. Free: %free%>>C:\dell\%computername%.csv

set str=!%1!
set "sign="
set bytes=0
set fraction=0

set fraction=%bytes:~0,1%
set bytes=%str:~-3%
set str=%str:~0,-3%
if "%sign%"=="GB" set sign=TB
if "%sign%"=="MB" set sign=GB
if "%sign%"=="KB" set sign=MB
if "%sign%"=="B" set sign=KB
if not defined sign set sign=B
if defined str goto loop
set %1=%bytes%.%fraction% %sign%
goto :eof

My System SpecsSystem Spec

 batch file for wmic command

Thread Tools

Similar help and support threads
Thread Forum
may have a batch file of this command?
each line, which is each command, is seperate, it would normally be typed in cmd, thanks netstop sppvc cd %windir%\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform rename tokens.dat cd %windir%\system32 net start sppsvc slui.exe dont know how...
General Discussion
DOS command in batch file
Hey Guys, I have 3 DOS scripts that has to be merged into one .bat file . Basically i am trying to clean the temp files and getting the svn update and compiling and publishing the .net webapplication. below are my individual scripts. to clean the file : @echo off echo *** Deleting...
General Discussion
run command: wmic useraccount get name,sid
When I run this command all I see is a quick flash for SID,s and I need to know how to pause the screen and probably also be able to print the results. What is the correct way to pause and print the resulting list?
General Discussion
In Need a batch file command
So, I need a command for batch files, or other things that a batch file can link to, that selects another window, say a text window(notepad) and then can be typed into. I've used the vbs scripting with Set oShell = CreateObject("WScript.Shell") oShell.AppActivate "Window name" ...
General Discussion
Batch File - For Command??
<This post has now been solved> Hi, Sorry if this is not the place but does anyone know how to do the following? I am trying to create a batch file to search a directory for a specified file type and list it in a text file then get the batch file to read that text file and copy all the...
General Discussion

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 20:17.
Twitter Facebook Google+