Can anyone help me as to how I can store multiple wmic get commands into a single batch file.
The following commands are what I am looking to add in a single batch.
1) wmic os get csname
2) wmic cpu get name
3) wmic os get caption
Now I understand 1 & 3 can be seperated from commas but the Idea is to get wmic os & wmic cpu run in the same batch file and output it to a particular location say c:\hardware.
Thanks in advance.
EDIT: I did figure out how to do that in the meanwhile. Below is the code. However this is saving the output in the form of rows. How can I save the output in the form of columns. That is the computer_name should be in one column and its subsequent row should have the value. Similarly Name should be the next column and its subsequent row should be the model of the laptop etc.
Below is the code:
@echo offif exist C:\dell\%computername%.csv del C:\dell\%computername%.csvset outputfile="C:\dell\%computername%.csv"hostname>>%outputfile%wmic csproduct get name>>%outputfile%wmic bios get serialnumber>>%outputfile%wmic diskdrive get model>>%outputfile%wmic path win32_physicalmedia get SerialNumber>>%outputfile%goto :eof
Open in new window
And I can't check here what happens in case the computer has for example more than one harddisk. I'm pretty sure it will fail or deliver incomplete results.