Link to home
Start Free TrialLog in
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.
Avatar of Shaun Vermaak
Shaun Vermaak
Flag of Australia image

@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

Avatar of ANTONIO G
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....
Weird, there is no loop involved
Well,

as soon as I launch the .bat file, it runs launching commands forever like a loop...
I've attached a file video.
ASKER CERTIFIED SOLUTION
Avatar of Shaun Vermaak
Shaun Vermaak
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
Tested and working