Page 1 of 2
BasicInfo
Posted: 24 Dec 2010 05:20
by mischi
Hello all,
is there somebody who can tell me/write example how to get some basic information about computer via cmd to the txt file?
I need especially CPU info, memory and from ipconfig IP addresses of all my network cards.
I supposed that it will be very easy via findstr but I was totally wrong
if I'll do:
systeminfo | findstr "Processor"the result will be
Processor(s): 1 Processor(s) Installed.
and this is not sufficient result
there should be more info
maybe I should use msinfo32 instead of systeminfo but i guess it is more complicated
many thanks for any advice and merry christmas
Re: BasicInfo
Posted: 24 Dec 2010 05:45
by rfpd
Looll put just systeminfo that should do it.
Regards rfpd
Re: BasicInfo
Posted: 24 Dec 2010 06:01
by mischi
definitively, but I don't need all info from systeminfo only about CPU...
Re: BasicInfo
Posted: 24 Dec 2010 10:06
by rfpd
Code: Select all
@echo off
FOR /F "skip=1 tokens=*" %%A IN ('REG.exe query
"HKEY_LOCAL_MACHINE\Hardware\Description\System
\CentralProcessor\0" /v "ProcessorNameString"') DO set "CPU=%%A"
echo %CPU%
pause
The output will show Processnamestring Reg_sz and then your cpu info, sorry i couldn't remove the part befor CPU info.
I was 30 minutes doing this
Re: BasicInfo
Posted: 24 Dec 2010 10:21
by !k
Re: BasicInfo
Posted: 24 Dec 2010 11:38
by rfpd
that will not says cpu info that he wants, watch, what he whants it's what is circuled by red.
Re: BasicInfo
Posted: 24 Dec 2010 13:25
by mischi
rfpd: thank you very much, it works
Honestly I should read for /? more carefully after that maybe I would know about this use
Let's say that whole "command" is clear for me, only parameter /v I don't understand:(
Never mind thank you one more time for your help.
Re: BasicInfo
Posted: 24 Dec 2010 17:36
by rfpd
You are welcome my friend /v means the name of the value on the regestry, by the way merry christmas and a happy new year
.
Re: BasicInfo
Posted: 30 Dec 2010 08:00
by mischi
hi guys, it's me again
I supposed that I will be able finish my bat file without help but I was totally wrong
Last informations what I need to collect via my script are IP addresses of all my network interfaces.
for example:
Network card 1: IP address
Network card 2: IP address
Network card 3: IP address
I had few ideas
but everything failed because there are more NCs. Do you have any idea how to do it?
For in combination with
regedit can't be used like in the previous case since default route is always different!
many thanks for any idea.
Re: BasicInfo
Posted: 30 Dec 2010 10:01
by aGerman
I think IPCONFIG /ALL should display this informations.
Regards
aGerman
Re: BasicInfo
Posted: 30 Dec 2010 10:10
by ChickenSoup
If you want just IP Addresses, Something like this:
Code: Select all
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION
set nicnum=1
for /f "tokens=2 delims=:" %%a in ('ipconfig /all^|find "IP Address"') do (
@echo Network Card !nicnum!:%%a
set /a nicnum+=1
)
Note: This probably does not account for a disconnected nic however.
Re: BasicInfo
Posted: 30 Dec 2010 10:33
by ChickenSoup
You may need it like this to account for both XP and 7. I do all my tests on Windows XP:
Code: Select all
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION
set mynum=1
REM.-- your code goes here
echo.Hello World
for /f "tokens=2 delims=:" %%a in ('ipconfig /all^|find /i "IP Address"') do (
@echo Network Card !mynum!:%%a
set /a mynum+=1
)
for /f "tokens=2 delims=:(" %%a in ('ipconfig /all^|find /i "IPv4 Address"') do (
@echo Network Card !mynum!:%%a
set /a mynum+=1
)
Re: BasicInfo
Posted: 30 Dec 2010 18:54
by ghostmachine4
ChickenSoup wrote:You may need it like this to account for both XP and 7. I do all my tests on Windows XP:
Code: Select all
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION
set mynum=1
REM.-- your code goes here
echo.Hello World
for /f "tokens=2 delims=:" %%a in ('ipconfig /all^|find /i "IP Address"') do (
@echo Network Card !mynum!:%%a
set /a mynum+=1
)
for /f "tokens=2 delims=:(" %%a in ('ipconfig /all^|find /i "IPv4 Address"') do (
@echo Network Card !mynum!:%%a
set /a mynum+=1
)
there's no need to call ipconfig 2 times. Do something to the find ( or rather use findstr) to make it search for those 2 patterns at the same time.
Re: BasicInfo
Posted: 31 Dec 2010 02:23
by mischi
ChickenSoup: thank you very much, i will take it to the office and test it, but on my home computer it is work exactly as I imagined it would.
ghostmachine4: I prefer leaving it like this, I will have to revise it a little and I more or less understand this record
but I will try to follow your suggestion.
thanks one more time and Happy New Year 2011
Re: BasicInfo
Posted: 31 Dec 2010 18:51
by ChickenSoup
ghostmachine4 wrote:there's no need to call ipconfig 2 times. Do something to the find ( or rather use findstr) to make it search for those 2 patterns at the same time.
ghostmachine4, I'm new to using findstr. Could you present an example of the better way to do it?