Avatar of ANTONIO G
ANTONIO G
 asked on

How create a batch file using WMIC

Hi,

I'd like to make a bach file (.bat) using these wmic commands :

wmic /output:c:\COMPUTERNAME_os.list os get /format:list

wmic /output:c:\COMPUTERNAME_sw_installati.list product get /format:list

wmic /output:c:\COMPUTERNAME_av.list /NAMESPACE:\\root\SecurityCenter2 PATH AntiVirusProduct GET /value /format:list

wmic process list full > c:\COMPUTERNAME_process.list

tasklist /svc > c:\COMPUTERNAME_servizio.list

systeminfo > c:\COMPUTER_sysinfo.list


At the end of the day I should have 6 files (.list)
I would be more than grateful if somebody can help me.

Thank you
Antonio
Italy.
Windows Batch* WMIC

Avatar of undefined
Last Comment
Shaun Vermaak

8/22/2022 - Mon
Shaun Vermaak

@echo off
wmic /output:%COMPUTERNAME%_os.list os get /format:list
wmic /output:%COMPUTERNAME%_sw_installati.list product get /format:list
wmic /output:%COMPUTERNAME%_av.list /NAMESPACE:\\root\SecurityCenter2 PATH AntiVirusProduct GET /value /format:list
wmic process list full > %COMPUTERNAME%_process.list
tasklist /svc > %COMPUTERNAME%_servizio.list
systeminfo > %COMPUTERNAME%_sysinfo.list

Open in new window

ANTONIO G

ASKER
Hi Shaun,

thanks a bunch for your answer.

I'm really sorry but it seems that does not work.
Launching the .bat file, it starts looping forever....
Shaun Vermaak

Weird, there is no loop involved
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
ANTONIO G

ASKER
Well,

as soon as I launch the .bat file, it runs launching commands forever like a loop...
I've attached a file video.
ANTONIO G

ASKER
ASKER CERTIFIED SOLUTION
Shaun Vermaak

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Shaun Vermaak

Here is video of batch
http://somup.com/cbeo2fRTJ
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ANTONIO G

ASKER
Thank you very much for your answer.

Well, now it stucks on the first command line : wmic os get /format:list > %COMPUTERNAME%_os.list
with no output at all.

It stucks for more than 30 seconds....

Here is another video of batch

C--Users-a_guarnieri1-Documents-Camt.mp4
Shaun Vermaak

Tested and working