How to write a simple batch file

I need a batch file to run the following from the command prompt:  wmic computersystem get model,name,manufacturer,systemtype

This batch file is for Windows 7 to get details for inventory that I am gathering.  Thanks
gloyola1Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bill PrewIT / Software Engineering ConsultantCommented:
What are you going to do with the output, do you want it in any particular format or in a file?  CSV, plain text?


»bp
0
Bill PrewIT / Software Engineering ConsultantCommented:
You can run that command right from a BAT file as it stands, for example:

@echo off
setlocal

wmic computersystem get model,name,manufacturer,systemtype

Open in new window


»bp
0
gloyola1Author Commented:
Hello, I want the end users that run this to send me back the information thru email.  So, as far as output goes something that will make it easy for them to send back to me in an email.  Thanks
0
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

Bill PrewIT / Software Engineering ConsultantCommented:
So would they cut and paste the output into an email, is that your thought?

You might try adding /format:list to the end of the command.  Or adding that and then saving as a file that they could then attach to an email to you.  Below vreates a file on their Desktop called info.txt that they could send you.

@echo off
setlocal

wmic computersystem get model,name,manufacturer,systemtype /format:list>"%USERPROFILE%\Desktop\info.txt"

Open in new window


»bp




»bp
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gloyola1Author Commented:
Yes, cut and paste.  Thanks
0
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
Something simple that would show it in a text file work?
Expanding on Bill's script:
@echo off
setlocal

wmic computersystem get model,name,manufacturer,systemtype > c:\temp\info.txt
notepad c:\temp\info.txt

Open in new window

0
gloyola1Author Commented:
Thanks for the help!
0
Bill PrewIT / Software Engineering ConsultantCommented:
Welcome, glad that helped.


»bp
0
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
Ditto. :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.