We help IT Professionals succeed at work.

How create a batch file using WMIC

ANTONIO G
ANTONIO G asked
on
3,691 Views
Last Modified: 2017-04-03
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.
Comment
Watch Question

Shaun VermaakSenior Consultant
CERTIFIED EXPERT
Awarded 2017
Distinguished Expert 2019

Commented:
@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

Author

Commented:
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 VermaakSenior Consultant
CERTIFIED EXPERT
Awarded 2017
Distinguished Expert 2019

Commented:
Weird, there is no loop involved

Author

Commented:
Well,

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

Author

Commented:
Senior Consultant
CERTIFIED EXPERT
Awarded 2017
Distinguished Expert 2019
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Shaun VermaakSenior Consultant
CERTIFIED EXPERT
Awarded 2017
Distinguished Expert 2019

Commented:
Here is video of batch
http://somup.com/cbeo2fRTJ

Author

Commented:
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 VermaakSenior Consultant
CERTIFIED EXPERT
Awarded 2017
Distinguished Expert 2019

Commented:
Tested and working
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.