Creating a script to gather PC information - to assist those asking for help

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
aGerman
Expert
Posts: 4090
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Creating a script to gather PC information - to assist those asking for help

#91 Post by aGerman » 29 Aug 2016 07:53

You're absolutely right. Even the manpage stated clearly it's kilobytes. Thanks!
As soon as I'm back home I'll correct it. Also I'll include the conditional DIR output.

Steffen

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

Re: Creating a script to gather PC information - to assist those asking for help

#92 Post by aGerman » 31 Aug 2016 12:01

In a Russian forum siberia-man posted a link to the script and asked the guys to run it
http://forum.script-coding.com/viewtopic.php?id=11968
The surprising result is that the thousands separator fails in the DIR output. I didn't even expect that it could be anything else than ',' or '.' :o But in the Russian output it actually is a 'non-breaking space' that appears as a 'ya' character in the editor window.

I will work around using CHCP and update the script.

Thank you siberia-man and thanks to the helpers at script-coding.com!
Большое спасибо!

Steffen

douglas.swehla
Posts: 75
Joined: 01 Jun 2016 09:25

Re: Creating a script to gather PC information - to assist those asking for help

#93 Post by douglas.swehla » 31 Aug 2016 13:29

aGerman wrote:All of you guys are very welcome to try it out and give a feedback


I ran it on my work computer, while connected to the work network, and got this result:

Code: Select all

--------------------------------------------------------------------------------
Windows version        :  Microsoft Windows [Version 6.1.7601]
Product name           :  Windows 7 Professional, 64 bit
Performance indicators :  Processor Cores: 4      Visible RAM: 4072532 kilobytes

Date/Time format       :  mm/dd/yy (12 hours)     Wed 08/31/2016  11:14:26.87
Extensions             :  system: Enabled   user: Enabled
Delayed expansion      :  system: Disabled  user: Disabled
Locale name            :  en-US       Code Pages: OEM  437    ANSI 1252
DIR  format            :  08/29/2016  09:46 AM     4,170,272,768 pagefile.sys
Permissions            :  Elevated Admin=No, Admin group=Yes

                          Missing from the tool collection:  debug


The code ran in just under 10 seconds.

I am able to use delayed expansion, so not sure what's up with that. When I have more time, I'll step through the code to see what's going on.

As discussed in some other messages, strictly speaking, my user account is not a member of the admin group. Instead, a 3rd-party program is used to grant elevated privileges to CMD.EXE. Given that, it would be more accurate to change the Permissions line to say "Can Elevate" rather than "Admin group". I know that's knit-picking, since both are answering the question "Can the user do elevated stuff?", so it won't bug me if you leave it as is.

It would be nice to have some basic user notification, like "Running <scriptname>.bat from DosTips.com. Please allow <timeframe> to complete. If script runs longer than <duration>, it may be hung. Press CTRL+C or CTRL+Break to stop, or just close this window."

Have we settled on a name for the script? Users can save it as whatever they like, of course, but I'd like to be able to refer to this project as something besides "that script that aGerman and foxidrive put together".

In the section "assign variables for used tools", if a command isn't found in System32, we could check some other locations before determining that it isn't available. These cover situations where the PATH isn't necessarily corrupted, but tools have been moved for whatever reason. The last few are reaching a bit, but I think the first two are pretty painless and a good idea.
  1. SysWOW64.
  2. All PATH locations (Can use WHERE command, or check for success of "command /?".)
  3. Wherever cmd.exe is running from, if it's not one of the above locations. (Could be extrapolated from %comspec% or %cmdcmdline%.)
  4. Any other location you think likely, such as "Program Files" or "Program Files (x86)".
  5. Consider recursive search of likely source folders to find things like "...\System32\tools\command.exe" (Can use 'ROBOCOPY /LEV:n /L' to limit depth of recursive search.)

If the PATH or PATHEXT variable is found to be corrupted or missing elements, should we offer to fix it immediately, or leave that until after the user reports the results? Some issues are more complicated than others, of course, but it should be easy enough to pre-pend the default PATH value to the existing one in the event that items are missing or that the whole variable has been cleared.

douglas.swehla
Posts: 75
Joined: 01 Jun 2016 09:25

Re: Creating a script to gather PC information - to assist those asking for help

#94 Post by douglas.swehla » 31 Aug 2016 13:35

aGerman wrote:The surprising result is that the thousands separator fails in the DIR output. I didn't even expect that it could be anything else than ',' or '.' :o But in the Russian output it actually is a 'non-breaking space' that appears as a 'ya' character in the editor window.

I will work around using CHCP and update the script.


DIR /? wrote:Displays a list of files and subdirectories in a directory.

DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N]
[/O[[:]sortorder]] [/P] [/Q] [/R] [/S] [/T[[:]timefield]] [/W] [/X] [/4]

[drive:][path][filename]
Specifies drive, directory, and/or files to list.

. . .

/C Display the thousand separator in file sizes. This is the
default. Use /-C to disable display of separator.



Does DIR /-C not solve the problem?

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

Re: Creating a script to gather PC information - to assist those asking for help

#95 Post by aGerman » 31 Aug 2016 14:06

Thanks Douglas!

I am able to use delayed expansion, so not sure what's up with that.

Yes you are able. The script outputs the default settings.

As discussed in some other messages, strictly speaking, my user account is not a member of the admin group. Instead, a 3rd-party program is used to grant elevated privileges to CMD.EXE.

In that case the program runs within an account that is part of the local admin group?

It would be nice to have some basic user notification, like "Running <scriptname>.bat from DosTips.com. Please allow <timeframe> to complete. If script runs longer than <duration>, it may be hung. Press CTRL+C or CTRL+Break to stop, or just close this window."

Actually the script name is out of interest. I can't even guess how much time the script would take on a certain machine :?

Have we settled on a name for the script? Users can save it as whatever they like, of course, but I'd like to be able to refer to this project as something besides "that script that aGerman and foxidrive put together".

It will probably be part of the sticky topic later on.

If the PATH or PATHEXT variable is found to be corrupted or missing elements, should we offer to fix it immediately, or leave that until after the user reports the results?

I don't want the script to do any changes. Just querying informations. We can later suggest how to fix it.

Does DIR /-C not solve the problem?

Of course /-C would solve it (and whenever you want to process the file size you should better use it :wink: ). On the other hand it's a simple way to see the thousand separator (as you can see the decimal separator in the output of %time%). Although I'm not sure what the forum software does with a "non-breaking space". Probably it will be replaced with a simple space.

Steffen

douglas.swehla
Posts: 75
Joined: 01 Jun 2016 09:25

Re: Creating a script to gather PC information - to assist those asking for help

#96 Post by douglas.swehla » 31 Aug 2016 15:28

aGerman wrote:Thanks Douglas!

You're welcome, Steffen! Of course, and as always.

aGerman wrote:I will work around using CHCP and update the script.
. . .
Of course /-C would solve it . . . On the other hand it's a simple way to see the thousand separator.

Just so I understand, do you mean you're going to use CHCP to force a standard code page (presumably 437), so that all output is the same?

aGerman wrote:Although I'm not sure what the forum software does with a "non-breaking space". Probably it will be replaced with a simple space.
Steffen

Short version: The forum respects non-breaking spaces. They display as ordinary spaces, not exotic characters. When re-sizing a window, character strings on either side of a NBSP are kept together. Code blocks don't break on spaces anyway, so the difference is moot.

Long version: You got me curious, so I went to the page you linked, copied the character in question (looks like a small, backwards capital R), and searched for it on the Wikipedia page for ANSI 1251 (https://en.wikipedia.org/wiki/Windows-1251). There were two results: characters 223 and 255. For me, typing Alt+255 displays a non-breaking space in both Notepad and at a command prompt, while Alt+223 displays a graphical symbol ('upper block', for lack of a better term).

Each line below starts with 7 characters: a single quote, the character copied from the forum, a comma, Alt+223, a second comma, Alt+255, and a final single quote. That series is followed by two dashes and a space, then a description of how the characters got into the DosTips editor. For the code-block and list versions, I repeated the steps, rather than copy/paste the lines already in the editor.

Normal message text:
'я,▀, '-- Copy/pasted or typed directly
'я,▀, '-- Copy/pasted or typed into Notepad, then copy/pasted here
'?,ß,ÿ'-- ECHOed into Notepad, then copy/pasted here
'?,▀, '-- ECHOed into CLIP, then pasted here

In a code block:

Code: Select all

'я,▀, '-- Copy/pasted or typed directly
'я,▀, '-- Copy/pasted or typed into Notepad, then copy/pasted here
'?,ß,ÿ'-- ECHOed into Notepad, then copy/pasted here
'?,▀, '-- ECHOed into CLIP, then pasted here


In a list:
  • 'я,▀, '-- Copy/pasted or typed directly
  • 'я','▀',' '-- Copy/pasted or typed into Notepad, then copy/pasted here
  • '?','ß','ÿ'-- ECHOed into Notepad, then copy/pasted here
  • '?','▀',' '-- ECHOed into CLIP, then pasted here

Here is some modified Lorem ipsum text with ordinary spaces, and with Alt+255 between sentences:

In normal text:
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliquaxxxxxxxxxxxxxxxxxxxx. xxxxxxxxxxxxxxxxxxxxUt enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliquaxxxxxxxxxxxxxxxxxxxx. xxxxxxxxxxxxxxxxxxxxUt enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."

In a list:
  • "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliquaxxxxxxxxxxxxxxxxxxxx. xxxxxxxxxxxxxxxxxxxxUt enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."
  • "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliquaxxxxxxxxxxxxxxxxxxxx. xxxxxxxxxxxxxxxxxxxxUt enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."

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

Re: Creating a script to gather PC information - to assist those asking for help

#97 Post by aGerman » 31 Aug 2016 17:18

In a computer everything is saved as bits and bytes. Almost everything in batch does only work with characters that have a width of only one byte. This means that the number of characters is limited to 256 (0x00 ... 0xFF). This is not even close to the number that you would need to represent any character in every known language. For that reason code pages are used. In every code page the characters 0x00 ... 0x7F are the same (so called ASCII characters). The remaining bytes can be used to display other characters. This means even if you will see the same bytes in a hex editor the displayed characters in a text editor differ depending on the used code page. So far all the theory.

Strange thing is that in most languages the code page used in the cmd window (OEMCP) differs from the code page that Windows applications (like notepad) use. The latter is called ANSI code page or ACP. In your case it's 437 and 1252, in my case it's 850 and 1252, and the Russians have 866 and 1251.

The wrong output can be explained as follows:
The text was copied from notepad that uses the ACP. The thousand separators are displayed as 'я'. In code page 1251 this character is represented with byte 0xFF (see https://en.wikipedia.org/wiki/Windows-1251). Now that we know which byte was originally saved to the variable we only have to look up in code page 866 (see https://en.wikipedia.org/wiki/Code_page_866) which was used for the redirection to the text file. As you can see byte 0xFF represents the NBSP. This is what you would have seen if you output it to the batch window.

If we change the code page using CHCP the byte will be converted to 0xA0 for the ECHO redirection that represents the NBSP in code page 1251. Thus, it will be displayed correctly in notepad in a Russian localization.

That's not the end of the story. The clipboard of your computer automatically converts the bytes from the source encoding to the target encoding of the program you paste it. Furthermore the target program may change it again in order to display it accordingly. E.g. the forum software of DosTips replaces a Tab character with 3 spaces and a NBSP with a space as you can see below.

Code: Select all

Tab '   '
NBSP ' '

Steffen

siberia-man
Posts: 174
Joined: 26 Dec 2013 09:28
Contact:

Re: Creating a script to gather PC information - to assist those asking for help

#98 Post by siberia-man » 01 Sep 2016 00:50

aGerman wrote:Thank you siberia-man and thanks to the helpers at script-coding.com!
Большое спасибо!


You are welcome!
Пожалуйста!

einstein1969
Expert
Posts: 776
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Re: Creating a script to gather PC information - to assist those asking for help

#99 Post by einstein1969 » 01 Sep 2016 08:34

In the past I have gather some information in a script, specially for fonts information

Code: Select all

@echo off

::: ritrovo i codepage di default. (locale settings)
::: https://technet.microsoft.com/en-us/library/cc976084.aspx

@echo off &setlocal

set OS
set PROCESSOR_ARCHITECTURE
set PROCESSOR_IDENTIFIER
set NUMBER_OF_PROCESSORS
set SESSIONNAME




for /f "tokens=2*" %%i in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\Nls\CodePage" /v "OEMCP"') do set /a OEMCP=%%j
for /f "tokens=2*" %%i in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\Nls\CodePage" /v "ACP"') do set /a ACP=%%j
set OEMCP
set ACP

for /f "tokens=2*" %%i in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\Nls\CodePage" /v "OEMHAL"') do set OEMHAL=%%j
set OEMHAL

rem nel for /f viene eseguito il comando in un nuovo cmd.exe contesto e sono attive le regole del parser cmd-line e non le regole del file batch
for /f "tokens=2*" %%i in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\GRE_Initialize\SmallFont" /v "OEMFONT.FON"') do set OEM_FIXED_FONT=%%j
set OEM_FIXED_FONT

for /f "tokens=4*" %%i in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "Lucida Console (TrueType)"') do set LUCIDA_CONSOLE=%%j
set LUCIDA_CONSOLE

for /f "tokens=2*" %%i in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\RasterFonts" /v "woafont"') do set woafont=%%j
set woafont


rem http://stackoverflow.com/questions/20270516/batch-file-parsing-a-registry-key-whose-name-contains-the-sign-through-the-fo
set "myvar=%%SystemRoot%%"
reg query "HKCU\Console\%myvar%_system32_cmd.exe"
rem for /f "usebackq tokens=3 delims=: " %%V in (`reg query "HKEY_CURRENT_USER\Console\%%myVar%%_system32_cmd.exe" /v "ScreenBufferSize"`) do echo "result=%%V"
for /f "usebackq tokens=1-3 delims=: " %%V in (`reg query "HKEY_CURRENT_USER\Console\%%myVar%%_system32_cmd.exe"`) do echo %%V = %%X

pause>nul

reg query "hklm\system\controlset001\control\nls\language" /v Installlanguage
reg query "hklm\system\controlset001\control\nls\language" /v Default

pause>nul

FOR /F "tokens=3 delims= " %%G in ('reg query "hklm\system\controlset001\control\nls\language" /v Installlanguage') DO (
  IF [%%G] EQU [0409] (
    ECHO English install language detected
  ) ELSE (
    ECHO Some other language detected
  )
)
 
pause>nul

Powershell get-UIculture
powershell get-host

pause>nul


rem https://technet.microsoft.com/en-us/library/cc721887(WS.10).aspx

rem Entering special characters or code points


rem Users can input characters that are not on the keyboard by pressing and holding the ALT key, and then typing the appropriate decimal code value for that character on the numeric keypad.
rem • If the first digit typed is 0, the value is recognized as a code point in the current input language. For example, pressing and holding the ALT key while typing 0163 produces £ (the pound sign: U+00A3 in the format for Unicode encoding) if the default input language is English (U.S.).

rem • If the first digit typed is any number between 1 and 9, the value is represented as a code point in the operating system's OEM code page. For example, pressing and holding the ALT key while typing 163 produces ú (U+00FA) if the code page is 437 (MS-DOS Latin US).


rem elenco codes oem
rem https://msdn.microsoft.com/en-us/library/windows/desktop/dd317756(v=vs.85).aspx
rem https://msdn.microsoft.com/en-us/goglobal/bb964655.aspx
rem https://msdn.microsoft.com/it-it/goglobal/bb688113
rem https://msdn.microsoft.com/it-it/library/dd374083.aspx
rem https://www.microsoft.com/typography/unicode/cscp.htm
rem http://www.unicode.org/standard/standard.html

pause>nul


exit /b

OEMHAL:
Specifies the default font supplied by the OEM (original equipment manufacturer).
This font is stored in Systemroot \WINNT\Fonts.
valore di dafault:   vgaoem.fon

ACP:
Indicates the default code page for ANSI characters.
These code pages are supported for Windows 3.1 compatibility.
For U.S. English, the value of this entry indicates that code page 1252 and its file, C_1252.nls, are used for ANSI characters.
default value:   1252=U.S.(ANSI) character set


MACCP is the default Macintosh code page. default 10000

OEMCP is the default OEM code page default 437

The OEMCP value controls to which OEM code page to translate ANSI, and the
OEMHAL value controls the display of extended characters at a command
prompt.

ANSI Codepage ID 1252 is used for all Western European languages, including
English.

The default OEM code page in Windows NT is the DOS 437 code page.

il code page 850 e' un DOS codepage che meglio si approssima al 1252 (windows codepage)

i codepage 437, 850, etc sono detti IBM PC code pages

il carattere TERMINAL corrisponde a vga850.fon

------------------
http://www.gpwindow.com/detail/link-8074.htm
How we see Windows is controlled by two primary settings:  The resolution and the DPI setting.

In Windows Vista (and earlier) the resolution could be changed for each user on a workstation, but the DPI setting was system based.

So Windows 7 introduced a change to allow the DPI setting to be set on a per user basis (only requiring a logout and login to make the change).  It is important to note that the user based DPI setting only affects the scalable fonts which can be adjusted without a reboot.

The bitmap font DPI settings are still system based and would still require a reboot to change and would also affect all users on the workstation.
------------------
http://marc.durdin.net/2011/07/fixing-windows-font-scaling-without-restarting-2/
-------
Converte da un codepage ad utf-8 : http://www.dostips.com/forum/viewtopic.php?p=36574

-----------------------------------------------------------------
LEGGERE by Liviu!

echoing other language texts? : http://www.dostips.com/forum/viewtopic.php?f=3&t=6322

In XP and earlier it's only possible if you already have an environment variable or a file/directory name containing those characters. In Windows 7 or later it's possible to build such strings in code from scratch, see viewtopic.php?f=3&t=5358 and viewtopic.php?p=34662.

Liviu

'cmd /u' does indeed turn "the output of internal commands to a pipe or file" to be Unicode, but it does not affect (or matter for) the console output itself - which was the original question here. The following will work correctly at a plain 'cmd' prompt as long as it's set to use a TT (not raster) font such as Lucida Console, without '/u' and regardless of the active codepage.


Liviu

FINE THREAD


output with setting ITALIANO in "lingua paese"

Code: Select all

OS=Windows_NT
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 6 Model 15 Stepping 13, GenuineIntel
NUMBER_OF_PROCESSORS=1
SESSIONNAME=Console
OEMCP=850
ACP=1252
OEMHAL=vgaoem.fon
OEM_FIXED_FONT=vga850.fon
LUCIDA_CONSOLE=lucon.TTF
woafont=app850.fon

HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe
    FaceName    REG_SZ    Terminal
    ScreenBufferSize    REG_DWORD    0x500050
    ScreenColors    REG_DWORD    0xf
    WindowSize    REG_DWORD    0x500050
    CursorSize    REG_DWORD    0x15
    FontSize    REG_DWORD    0x80008
    FontFamily    REG_DWORD    0x30
    FontWeight    REG_DWORD    0x190

HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe =
FaceName = Terminal
ScreenBufferSize = 0x500050
ScreenColors = 0xf
WindowSize = 0x500050
CursorSize = 0x15
FontSize = 0x80008
FontFamily = 0x30
FontWeight = 0x190

HKEY_LOCAL_MACHINE\system\controlset001\control\nls\language
    Installlanguage    REG_SZ    0410


HKEY_LOCAL_MACHINE\system\controlset001\control\nls\language
    Default    REG_SZ    0410

Some other language detected

LCID             Name             DisplayName
----             ----             -----------
1040             it-IT            Italiano (Italia)




Name             : ConsoleHost
Version          : 2.0
InstanceId       : 5b0e5949-cb08-4b02-b7fc-4c1c985e91da
UI               : System.Management.Automation.Internal.Host.InternalHostUserI
                   nterface
CurrentCulture   : it-IT
CurrentUICulture : it-IT
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace


output with setting ENGLISH in "lingua paese"

Code: Select all

PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 6 Model 15 Stepping 13, GenuineIntel
NUMBER_OF_PROCESSORS=1
SESSIONNAME=Console
OEMCP=437
ACP=1252
OEMHAL=vgaoem.fon
OEM_FIXED_FONT=vgaoem.fon
LUCIDA_CONSOLE=lucon.TTF
woafont=dosapp.fon

HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe
    FaceName    REG_SZ    Lucida Console
    ScreenBufferSize    REG_DWORD    0x3200050
    ScreenColors    REG_DWORD    0xf
    WindowSize    REG_DWORD    0x3d0050
    CursorSize    REG_DWORD    0x15
    FontSize    REG_DWORD    0xa0000
    FontFamily    REG_DWORD    0x36
    FontWeight    REG_DWORD    0x190

HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe =
FaceName = Lucida
ScreenBufferSize = 0x3200050
ScreenColors = 0xf
WindowSize = 0x3d0050
CursorSize = 0x15
FontSize = 0xa0000
FontFamily = 0x36
FontWeight = 0x190

HKEY_LOCAL_MACHINE\system\controlset001\control\nls\language
    Installlanguage    REG_SZ    0410


HKEY_LOCAL_MACHINE\system\controlset001\control\nls\language
    Default    REG_SZ    0409

Some other language detected

LCID             Name             DisplayName
----             ----             -----------
1040             it-IT            Italiano (Italia)




Name             : ConsoleHost
Version          : 2.0
InstanceId       : e5831371-6377-4f35-af90-eaaf92aa8bc7
UI               : System.Management.Automation.Internal.Host.InternalHostUserI
                   nterface
CurrentCulture   : it-IT
CurrentUICulture : it-IT
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace



There are some information at the end of script. I hope this info are welcome for merging in the main script.

einstein1969

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

Re: Creating a script to gather PC information - to assist those asking for help

#100 Post by aGerman » 01 Sep 2016 13:07

Thank you einstein1969! :)

Indeed PowerShell could provide additional possibilities. Let me think about it. Although the downward compatibility is a worry to me :?
I think we could use it alternatively if other methods failed.

Steffen

siberia-man
Posts: 174
Joined: 26 Dec 2013 09:28
Contact:

Re: Creating a script to gather PC information - to assist those asking for help

#101 Post by siberia-man » 01 Sep 2016 14:48

Flasher from Russian forum reports the same result and the script works a bit longer.

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

Re: Creating a script to gather PC information - to assist those asking for help

#102 Post by aGerman » 01 Sep 2016 16:11

Thank you and thanks to Flasher!

It's more complicated than I thought in the first place.
I changed the code page at the false position in the script :oops: It has to be changed for the processing of DIR as well as for the assignment of the variable. Because DIR was executed inside of the head of the loop it runs in another instance of cmd.exe where CHCP has to be applied additionally. In order to avoid failing again I replaced the thousand separator in my registry with a non-ASCII character for test purposes. Seems to be working now.
Unfortunately the CLIP command would overcomplicate everything. I had to remove it. Hence the output has to be always copied by hand.

I updated the script again.

Steffen

siberia-man
Posts: 174
Joined: 26 Dec 2013 09:28
Contact:

Re: Creating a script to gather PC information - to assist those asking for help

#103 Post by siberia-man » 02 Sep 2016 01:01

Hi Steffen,

I was able to run your script. It have launched notepad with the following output:

Code: Select all

--------------------------------------------------------------------------------
Windows version        :  Microsoft Windows [Version 6.1.7601]
Product name           :  Windows 7 Enterprise, 64 bit
Performance indicators :  Processor Cores: 4      Visible RAM: 8283248 kilobytes

Date/Time format       :  yy/mm/dd (24 hours)     2016-09-02   7:36:18,16
Extensions             :  system: Enabled   user: Enabled
Delayed expansion      :  system: Disabled  user: Disabled
Locale name            :  ru-RU       Code Pages: OEM  866    ANSI 1251
DIR  format            :  2016-09-01  09:35     8 482 045 952 pagefile.sys
Permissions            :  Elevated Admin=Yes, Admin group=Yes

                          Missing from the tool collection:  debug


Most probably sometime ago I have set up the correct code page for DOS sessions.

Additionally I have asked on Russian forum, if they bother about 'ya' symbols in DIR output.

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

Re: Creating a script to gather PC information - to assist those asking for help

#104 Post by aGerman » 02 Sep 2016 14:58

siberia-man

Sorry for my late response. Thank you very much once again! Now everything looks as expected :D
Only one additional question: Did you check if the rusults are correct? (E.g. did you really run the batch script with elevated rights as stated in the output file?)

Steffen

siberia-man
Posts: 174
Joined: 26 Dec 2013 09:28
Contact:

Re: Creating a script to gather PC information - to assist those asking for help

#105 Post by siberia-man » 04 Sep 2016 01:26

Do you mean this one?

Elevated Admin=Yes, Admin group=Yes


Yes. That's right.

Post Reply