batchInfo - a system information log

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
stackoverflow
Posts: 3
Joined: 08 Jan 2017 08:34

batchInfo - a system information log

#1 Post by stackoverflow » 08 Jan 2017 08:58

After reading some tales from TFTS subreddit, I got intrigued, can I make something that'll log your system information?
Then I proceeded to search on Google, I found several programs. But I wanted to do it myself.

So here it is: https://github.com/intrnl/batchScripts/blob/master/batchInfo.bat

It logs your OS information, and also memory, video, sound, logical disk, network, printer, user accounts, installed programs, context menu handlers, running processes, services that are either started or stopped, system drivers and also Plug and Play devices.

The main idea is, that if your PC is in a critical state, this script can help you determine what's currently going on, although it can also be used for general system information by using the command-line arguments to alter the log file.

Any help from you guys is very much appreciated, thanks!
Last edited by stackoverflow on 21 Jan 2017 02:53, edited 2 times in total.

aGerman
Expert
Posts: 4654
Joined: 22 Jan 2010 18:01
Location: Germany

Re: batchInfo - a system information log

#2 Post by aGerman » 08 Jan 2017 10:02

Your script is highly language dependent.
Have a look at the first few lines of systeminfo on my PC:

Code: Select all

C:\Users\steffen>systeminfo

Hostname:                                      DESKTOP-2KLLDT9
Betriebssystemname:                            Microsoft Windows 10 Home
Betriebssystemversion:                         10.0.14393 Nicht zutreffend Build 14393
Betriebssystemhersteller:                      Microsoft Corporation
Betriebssystemkonfiguration:                   Eigenständige Arbeitsstation
Betriebssystem-Buildtyp:                       Multiprocessor Free
Registrierter Benutzer:                        steffen
Registrierte Organisation:
Produkt-ID:                                    00325-86334-25774-AAOEM
Ursprüngliches Installationsdatum:             04.10.2016, 03:28:08
Systemstartzeit:                               01.01.2017, 19:29:12
Systemhersteller:                              ASUSTeK COMPUTER INC.
Systemmodell:                                  T100TAF
Systemtyp:                                     X86-based PC

Not even one of your findstr filters would work here.

Steffen

stackoverflow
Posts: 3
Joined: 08 Jan 2017 08:34

Re: batchInfo - a system information log

#3 Post by stackoverflow » 09 Jan 2017 06:01

aGerman wrote:Your script is highly language dependent.
Have a look at the first few lines of systeminfo on my PC:

Code: Select all

...

Not even one of your findstr filters would work here.

Steffen

Yeah, that's what I've been thinking actually. I've been trying to think of ways to overcome with that problem.

I've been thinking to use the following solution:http://stackoverflow.com/questions/22307698/reading-a-specific-line-in-a-text-file-to-a-variable-in-a-batch-file

Code: Select all

for /F "skip=4 delims=" %%i in (xprtest.txt) do if not defined xprvar set "xprvar=%%i"


The following code that I took from that solution will grab line 5 from "xprtest" text file.

But for now, I'll probably put up a sign that it wouldn't work on non-English language.
or that I could just stop using systeminfo altogether and use WMIC instead (there could still be chance of the localization thing happening though).
Last edited by stackoverflow on 12 Jan 2017 06:20, edited 1 time in total.

aGerman
Expert
Posts: 4654
Joined: 22 Jan 2010 18:01
Location: Germany

Re: batchInfo - a system information log

#4 Post by aGerman » 09 Jan 2017 07:11

Here are the links to a script and informations about its development.
viewtopic.php?f=3&t=7420
viewtopic.php?f=3&t=7347
Its purpose is NOT to collect as many informations as possible. It only gathers a few data in order to enable helpers here at DosTips to provide an appropriate solution...
It was a lot of investigation and efforts to make it run for several system preconditions.

Steffen

stackoverflow
Posts: 3
Joined: 08 Jan 2017 08:34

Re: batchInfo - a system information log

#5 Post by stackoverflow » 21 Jan 2017 02:59

Updated to 1.1

I moved everything that uses systeminfo to using WMIC now, I don't think there might be language issues but I put up a language code check just to make sure, although you could easily bypass this with the -d flag.
I rewrote the fetch part from scratch, allowing for the ability to skip certain part of the info fetch. Not sure how it would stand up to long-term use but at least it works for now.
Anyway since you can skip certain fetching, you can now do general system info log.

Have fun! :)

Post Reply