• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 47
  • Last Modified:

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
0
gloyola1
Asked:
gloyola1
  • 4
  • 3
  • 2
2 Solutions
 
Bill PrewCommented:
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 PrewCommented:
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
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
Bill PrewCommented:
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
 
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 PrewCommented:
Welcome, glad that helped.


»bp
0
 
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
Ditto. :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

  • 4
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now