Page 1 of 1

VER for the File Version number of my chosen *.EXE

Posted: 22 Jul 2011 02:56
by alan_b
VER would be nice if it was not committed to the Windows version
I would like a command (hopefully internal) that would give the File Version of any *.exe I select.

I have a BAT script that processes each of 200+ instances of the same executable.
For each it puts in a text file :-
The location where the executable is held;
The DIR output showing the file size and time stamp(s);
YOUR SUGGESTIONS PLEASE for the File version, e.g. 4.2.3622.0

By using Windows a right click / context menu / properties will allow me to see the Details Tab containing information,
such as File version 4.2.3622.0
Unfortunately I cannot copy and paste,
and far more tedious than a manual copy is that each instance requires me to MOUNT a partition image file,
and use Explorer to access the mounted folder and file,
and when I eventually get the File Version I have forgotten which of the 200 image files I just mounted ! !

A BAT script is my only hope for holding onto my sanity.

Regards
Alan

Re: VER for the File Version number of my chosen *.EXE

Posted: 22 Jul 2011 03:07
by Ed Dyreen
A BAT script is my only hope for holding onto my sanity.
Why ? This I would typically do in autoIT
I don't know how to retrieve version information, without the use of an external tool or other language.
But maybe with some dll magic...

Re: VER for the File Version number of my chosen *.EXE

Posted: 22 Jul 2011 03:48
by alan_b
I fear that it will take me more than half an hour to master the use of AutoIt so do not wish to go down that road.
I was hoping that there was a suitable command I had forgotten from when I used Command.com,
or a suitable command I never knew about in CMD.EXE.

I will probably have to settle for the time stamps to indicate when there were version updates.

Regards
Alan

Re: VER for the File Version number of my chosen *.EXE

Posted: 22 Jul 2011 07:49
by Acy Forsythe
You can use Filever.exe Alan...

It's not an internal command, but it is native windows, but you do have to download it or extract it because by default it's not there I don't think...

Here's a link: http://support.microsoft.com/kb/913111

Re: VER for the File Version number of my chosen *.EXE

Posted: 22 Jul 2011 08:11
by aGerman
The only alternative I could provide is a VBScript chimera:

Code: Select all

@echo off &setlocal

(
  echo Set objFSO = CreateObject^("Scripting.FileSystemObject"^)
  echo Set objShell = CreateObject^("Shell.Application"^)
  echo Set objFolderItem = objShell.Namespace^(objFSO.GetParentFolderName^(WScript.Arguments^(0^)^)^).ParseName^(objFSO.GetFileName^(WScript.Arguments^(0^)^)^)
  echo WScript.Echo objFolderItem.ExtendedProperty^("FileVersion"^) ^& ";" ^& objFolderItem.ExtendedProperty^("ProductVersion"^)
)>"%temp%\ver.vbs"

set "filename=C:\Windows\system32\cmd.exe"

for /f "tokens=1,2 delims=; eol=" %%a in ('cscript //nologo "%temp%\ver.vbs" "%filename%"') do (
  echo File Version:    %%a
  echo Product Version: %%b
)

del "%temp%\ver.vbs"
pause


Regards
aGerman

Re: VER for the File Version number of my chosen *.EXE

Posted: 22 Jul 2011 09:59
by alan_b
Acy Forsythe wrote:You can use Filever.exe Alan...

Thanks, but there are 3 strikes against it so it is out - and a fourth strike is a killer :-
1) Your link tells me it is not suitable for my Windows version 7;
2) It appears that the "version" tab was replaced with the "Details" tab, hence it does not run under Windows 7 according to
http://stackoverflow.com/questions/4854 ... -windows-7
3) It looks like a 4 MB download to get it

4) The killer strike
First I have to get through a WGA validation before M.S. will give it to me,
and although my clean install in February has gone through WGA at that time,
there was a month or so later an unannounced out-of-cycle patch update to the WGA tool that crashed through my barriers.
It was claimed to improve WGA capability against license code cracks and things,
and if it detected a fraud it was supposed to cause an inconvenience twice a year.
There-after Windows was normal for about 1 minute from power-up,
after which it totally ignored everything other than me cutting off the electricity.
This was a rock solid repetition every time I powered up, and it never complained - it just died every time.

Once bitten twice shy.

Regards
Alan

Re: VER for the File Version number of my chosen *.EXE

Posted: 22 Jul 2011 10:38
by alan_b
aGerman wrote:The only alternative I could provide is a VBScript chimera:

Thanks, I like it.
I trust you and your code, but I am not so sure about cscript under Windows 7
Something is cheating ! ! !

It takes 2350 mSec to properly execute the code ('cscript //nologo "%temp%\ver.vbs" "%filename%"')
And the next 5 attempts it cheats and gives me the same answer in only 100 mSec.
It seems to recognise that it has given me the answer before and it just pulls the same answer from a cache ! !

I would appreciate an explanation if possible.
My concern is that if it just gives the same answer to the same question it is going to be wrong.

I am mounting as K:\ many different archive partition image files of Partition C:\
and therefore whilst the same answer is always true for C:\Windows\system32\cmd.exe
it will not be true for K:\Windows\system32\cmd.exe
and my actual interest is not in cmd.exe but an Application executable that has been updated several times with various side-effects.

I launched CMD.EXE and repeatedly ran my Test.bat 7 times
To launch cscript and have it complete in 110 mSec is unbelievably fast.
E:\Images>Test
16:36:02.26 #
File Version: 6.1.7601.17514
16:36:04.61 ##
cscript took 2350. mSec
E:\Images>Test
16:36:23.88 #
File Version: 6.1.7601.17514
16:36:23.99 ##
cscript took 110. mSec
E:\Images>Test
16:36:27.64 #
File Version: 6.1.7601.17514
16:36:27.75 ##
cscript took 110. mSec
E:\Images>Test
16:36:29.60 #
File Version: 6.1.7601.17514
16:36:29.71 ##
cscript took 110. mSec
E:\Images>Test
16:36:31.22 #
File Version: 6.1.7601.17514
16:36:31.32 ##
cscript took 100. mSec
E:\Images>Test
16:36:32.97 #
File Version: 6.1.7601.17514
16:36:33.08 ##
cscript took 100. mSec
E:\Images>Test
16:36:34.65 #
File Version: 6.1.7601.17514
16:36:37.01 ##
cscript took 2360. mSec
E:\Images>

You do not need to analyse my timing code for errors, you can see that "16:36:23.99 ##" is only 0.11 seconds after "16:36:23.88 #"
Perhaps cscript may seize 100% CPU cycles so that clocks stop still - but I was watching whilst it happened.
My memory is a little variable but I do not think I suffer 2 second blackouts 14 times a minute ! ! !

This is my slight adaptation of your code. It will only get more complicated when I start mounting and un-mounting

Code: Select all

@echo off &setlocal

(
  echo Set objFSO = CreateObject^("Scripting.FileSystemObject"^)
  echo Set objShell = CreateObject^("Shell.Application"^)
  echo Set objFolderItem = objShell.Namespace^(objFSO.GetParentFolderName^(WScript.Arguments^(0^)^)^).ParseName^(objFSO.GetFileName^(WScript.Arguments^(0^)^)^)
  echo WScript.Echo objFolderItem.ExtendedProperty^("FileVersion"^) ^& ";" ^& objFolderItem.ExtendedProperty^("ProductVersion"^)
)>"%temp%\ver.vbs"

echo %TIME% #
FOR /F "tokens=1-4 delims=:." %%d in ("%TIME%") do (
  SET /A T1=%%d*360000+1%%e*6000+1%%f*100+1%%g-610100
)

set "filename=C:\Windows\system32\cmd.exe"

for /f "tokens=1,2 delims=; eol=" %%a in ('cscript //nologo "%temp%\ver.vbs" "%filename%"') do (
  echo File Version:    %%a
)

FOR /F "tokens=1-4 delims=:." %%d in ("%TIME%") do (
  SET /A T2=%%d*360000+1%%e*6000+1%%f*100+1%%g-610100-%T1%
)
echo %TIME% ##

ECHO cscript took %T2%0. mSec

del "%temp%\ver.vbs"


Regards
Alan

Re: VER for the File Version number of my chosen *.EXE

Posted: 22 Jul 2011 10:45
by !k
alan_b
Try info extractor from Total Commander plugins _http://forum.wincmd.ru/viewtopic.php?t=13510
with exeinfo.wdx _http://www.totalcmd.net/plugring/wdx_exeinfo.html
or FileSys.wdx _http://totalcmd.pl/download/wdx/oth/FileSys

Code: Select all

for /f "delims=" %%C in ('wdx_read.exe exeinfo.wdx C:\WINDOWS\explorer.exe 2') do set "VersionOfFile=%%~C"
for /f "delims=" %%C in ('wdx_read.exe exeinfo.wdx C:\WINDOWS\explorer.exe 7') do set "VersionOfProduct=%%~C"
for /f "delims=" %%C in ('wdx_read.exe filesys.wdx C:\WINDOWS\explorer.exe 16') do set "versionstring=%%~C"
set version


Image

exeinfo.wdx fields:

Code: Select all

[0]|ft_string|CompanyName|
[1]|ft_string|FileDescription|
[2]|ft_string|FileVersion|
[3]|ft_string|InternalName|
[4]|ft_string|LegalCopyRight|
[5]|ft_string|OriginalFileName|
[6]|ft_string|ProductName|
[7]|ft_string|ProductVersion|
[8]|ft_string|Comments|
[9]|ft_string|LegalTrademarks|
[10]|ft_string|PrivateBuild|
[11]|ft_string|SpecialBuild|

filesys.wdx fields:

Code: Select all

[0]ft_stringname
[1]ft_numeric_64sizebytes|kbytes|Mbytes|Gbytes
[2]ft_datecreationdate
[3]ft_timecreationtime
[4]ft_datewritedate
[5]ft_timewritetime
[6]ft_dateaccessdate
[7]ft_timeaccesstime
[8]ft_numeric_32attributes
[9]ft_booleanarchive
[10]ft_booleanread only
[11]ft_booleanhidden
[12]ft_booleansystem
[13]ft_booleancompressed
[14]ft_booleanencrypted
[15]ft_booleansparse
[16]ft_stringversionstring
[17]ft_numeric_floatingversionnr
[18]ft_multiplechoicefile typefile|folder|reparse point


or WDX Test _http://www.totalcmd.net/plugring/wdxtest.html
Image

Re: VER for the File Version number of my chosen *.EXE

Posted: 22 Jul 2011 13:23
by aGerman
Hello Alan,

we all know that calling a VBScript wastes your time. Since you told us you would prefer an "internal" solution I have no better idea than using WSH. But there is a way to make it faster if you have to check a list of file names.

list.txt

Code: Select all

C:\Windows\System32\cmd.exe
C:\Windows\System32\find.exe
C:\foo\bar.exe


ver.vbs

Code: Select all

strSourceFile = WScript.Arguments(0)

Dim objFSO : Set objFSO = CreateObject("Scripting.FileSystemObject")
If Not objFSO.FileExists(strSourceFile) Then WScript.Quit 1
Dim objShell : Set objShell = CreateObject("Shell.Application")
Set objSourceFile = objFSO.OpenTextFile(strSourceFile, 1)
Do While Not objSourceFile.AtEndOfStream
  strLine = Trim(objSourceFile.ReadLine)
  arrVersions = GetFileDetailInfos(strLine)
  If VarType(arrVersions) = vbEmpty Then
    WScript.Echo strLine & ";" & "File Not Found"
  Else
    WScript.Echo strLine & ";" & arrVersions(0) & ";" & arrVersions(1)
  End If
Loop
objSourceFile.Close

Function GetFileDetailInfos(strFileFullName)
  Dim arrVer(1)
  If objFSO.FileExists(strFileFullName) Then
    Set objFolderItem = objShell.Namespace(objFSO.GetParentFolderName(strFileFullName)) _
      .ParseName(objFSO.GetFileName(strFileFullName))
    arrVer(0) = objFolderItem.ExtendedProperty("FileVersion")
    arrVer(1) = objFolderItem.ExtendedProperty("ProductVersion")
    GetFileDetailInfos = arrVer
  End If
End Function


call_ver.bat

Code: Select all

@echo off &setlocal
for /f "tokens=1-3 delims=; eol=" %%a in ('cscript //nologo "ver.vbs" "list.txt"') do (
  echo File:            %%a
  echo File Version:    %%b
  echo Product Version: %%c
  echo(
)
pause>nul


output:

Code: Select all

File:            C:\Windows\System32\cmd.exe
File Version:    6.1.7601.17514
Product Version: 6.1.7601.17514

File:            C:\Windows\System32\find.exe
File Version:    6.1.7600.16385
Product Version: 6.1.7600.16385

File:            C:\foo\bar.exe
File Version:    File Not Found
Product Version:


Hope that helps.
Regards
aGerman

Re: VER for the File Version number of my chosen *.EXE

Posted: 22 Jul 2011 15:34
by alan_b
aGerman wrote:Hello Alan,
we all know that calling a VBScript wastes your time. Since you told us you would prefer an "internal" solution I have no better idea than using WSH. But there is a way to make it faster if you have to check a list of file names.

Unfortunately there is no "list.txt", it is always the same "K:\Program Files\Macrium\Reflect\reflect.exe" in the temporary virtual partition K:\,
as each of the Partition C:\ image files are mounted and dismounted in turn.
I have 200+ such image files and am focussed on changes in one group of 80.

I am not too concerned with the time taken. It already takes half a second to dismount on one image file and mount the next.
80 * 2.5 or 3.0 seconds is acceptable for what I intend to be a one time only analysis. I can always have another cup of coffee.

What really concerns me is why it never evaluates but always spits out the same answer until 33 seconds later.

Since every instance of "K:\Program Files\Macrium\Reflect\reflect.exe" can be a different historic release,
then I believe the first answer will be good, but the next 30 off answers will not be based on the next mounted version.

I really would appreciate an explanation of why the test code below waits 33 seconds between evaluations.

My code has the tricks that :-

1. It calls my adaptation of your code 22 times, with a 5 second delay just to see several 33 second periods without hundreds of lines on the screen,
and shorter delay periods just result in more 100 mSec periods and lines of text between each evaluation;
2. I added %1 to your file name "%temp%\ver.vbs" in the hope that whatever was cached and re-used as "%temp%\ver22.vbs" would not get re-used when I invoked "%temp%\ver21.vbs" - but that had no effect.

I would appreciate advice upon whether you see the same effect I observe,
and whether any trust can be given to answers with no "thinking" behind them

Code: Select all

@echo off &setlocal

FOR /L %%x IN (22,-1,1) DO (
  CALL :VERSION_CODE %%x
  ping -w 40 -n 6 127.0.0.1 > nul
)
PAUSE
GOTO :EOF

:VERSION_CODE

(
  echo Set objFSO = CreateObject^("Scripting.FileSystemObject"^)
  echo Set objShell = CreateObject^("Shell.Application"^)
  echo Set objFolderItem = objShell.Namespace^(objFSO.GetParentFolderName^(WScript.Arguments^(0^)^)^).ParseName^(objFSO.GetFileName^(WScript.Arguments^(0^)^)^)
  echo WScript.Echo objFolderItem.ExtendedProperty^("FileVersion"^) ^& ";" ^& objFolderItem.ExtendedProperty^("ProductVersion"^)
)>"%temp%\ver%1.vbs"

SET TA=%TIME%
echo %TIME% #
FOR /F "tokens=1-4 delims=:." %%d in ("%TA%") do (
  SET /A T1=%%d*360000+1%%e*6000+1%%f*100+1%%g-610100
)

set "filename=C:\Windows\system32\cmd.exe"

for /f "tokens=1,2 delims=; eol=" %%a in ('cscript //nologo "%temp%\ver%1.vbs" "%filename%"') do (
  echo File Version:    %%a
)

SET TB=%TIME%
echo %TIME% ##
FOR /F "tokens=1-4 delims=:." %%d in ("%TB%") do (
  SET /A T2=%%d*360000+1%%e*6000+1%%f*100+1%%g-610100-%T1%
)

ECHO %1 cscript took %TB% - %TA% = %T2%0. mSec

rem dir "%temp%\ver%1.vbs"
del "%temp%\ver%1.vbs"

Regards
Alan

Re: VER for the File Version number of my chosen *.EXE

Posted: 22 Jul 2011 16:53
by aGerman
I don't find the same effect. My output:

Code: Select all

 0:39:08,18 #
File Version:    6.1.7601.17514
 0:39:08,97 ##
22 cscript took  0:39:08,97 -  0:39:08,18 = 790. mSec
 0:39:14,27 #
File Version:    6.1.7601.17514
 0:39:15,38 ##
21 cscript took  0:39:15,38 -  0:39:14,27 = 1110. mSec
 0:39:20,56 #
File Version:    6.1.7601.17514
 0:39:21,28 ##
20 cscript took  0:39:21,27 -  0:39:20,56 = 710. mSec
 0:39:26,67 #
File Version:    6.1.7601.17514
 0:39:27,60 ##
19 cscript took  0:39:27,59 -  0:39:26,66 = 930. mSec
 0:39:33,07 #
File Version:    6.1.7601.17514
 0:39:33,93 ##
18 cscript took  0:39:33,93 -  0:39:33,07 = 860. mSec
 0:39:39,44 #
File Version:    6.1.7601.17514
 0:39:40,17 ##
17 cscript took  0:39:40,17 -  0:39:39,44 = 730. mSec
 0:39:45,43 #
File Version:    6.1.7601.17514
 0:39:46,20 ##
16 cscript took  0:39:46,20 -  0:39:45,43 = 770. mSec
 0:39:51,58 #
File Version:    6.1.7601.17514
 0:39:52,24 ##
15 cscript took  0:39:52,24 -  0:39:51,58 = 660. mSec
 0:39:57,50 #
File Version:    6.1.7601.17514
 0:39:58,27 ##
14 cscript took  0:39:58,27 -  0:39:57,50 = 770. mSec
 0:40:03,45 #
File Version:    6.1.7601.17514
 0:40:04,50 ##
13 cscript took  0:40:04,50 -  0:40:03,45 = 1050. mSec
 0:40:09,78 #
File Version:    6.1.7601.17514
 0:40:10,41 ##
12 cscript took  0:40:10,41 -  0:40:09,78 = 630. mSec
 0:40:15,87 #
File Version:    6.1.7601.17514
 0:40:17,27 ##
11 cscript took  0:40:17,27 -  0:40:15,87 = 1400. mSec
 0:40:22,44 #
File Version:    6.1.7601.17514
 0:40:23,25 ##
10 cscript took  0:40:23,25 -  0:40:22,44 = 810. mSec
 0:40:28,40 #
File Version:    6.1.7601.17514
 0:40:29,15 ##
9 cscript took  0:40:29,15 -  0:40:28,40 = 750. mSec
 0:40:34,41 #
File Version:    6.1.7601.17514
 0:40:35,03 ##
8 cscript took  0:40:35,02 -  0:40:34,41 = 610. mSec
 0:40:40,23 #
File Version:    6.1.7601.17514
 0:40:40,99 ##
7 cscript took  0:40:40,99 -  0:40:40,23 = 760. mSec
 0:40:46,32 #
File Version:    6.1.7601.17514
 0:40:47,89 ##
6 cscript took  0:40:47,88 -  0:40:46,32 = 1560. mSec
 0:40:53,23 #
File Version:    6.1.7601.17514
 0:40:54,03 ##
5 cscript took  0:40:54,03 -  0:40:53,23 = 800. mSec
 0:40:59,16 #
File Version:    6.1.7601.17514
 0:40:59,91 ##
4 cscript took  0:40:59,91 -  0:40:59,16 = 750. mSec
 0:41:05,19 #
File Version:    6.1.7601.17514
 0:41:05,88 ##
3 cscript took  0:41:05,88 -  0:41:05,19 = 690. mSec
 0:41:11,36 #
File Version:    6.1.7601.17514
 0:41:12,06 ##
2 cscript took  0:41:12,06 -  0:41:11,35 = 710. mSec
 0:41:17,59 #
File Version:    6.1.7601.17514
 0:41:18,35 ##
1 cscript took  0:41:18,34 -  0:41:17,59 = 750. mSec
Drücken Sie eine beliebige Taste . . .


Also I copied find.exe to D:\test\test1, D:\test\test2 and D:\test\test3, changed the product version in test2 and test3 with a HEX editor and used the following code:

Code: Select all

@echo off &setlocal

(
  echo Set objFSO = CreateObject^("Scripting.FileSystemObject"^)
  echo Set objShell = CreateObject^("Shell.Application"^)
  echo Set objFolderItem = objShell.Namespace^(objFSO.GetParentFolderName^(WScript.Arguments^(0^)^)^).ParseName^(objFSO.GetFileName^(WScript.Arguments^(0^)^)^)
  echo WScript.Echo objFolderItem.ExtendedProperty^("FileVersion"^) ^& ";" ^& objFolderItem.ExtendedProperty^("ProductVersion"^)
)>"%temp%\ver.vbs"

set "filename=K:\find.exe"

for /l %%i in (1,1,3) do (
  subst K: D:\test\test%%i
  for /f "tokens=1,2 delims=; eol=" %%a in ('cscript //nologo "%temp%\ver.vbs" "%filename%"') do (
    echo File Version:    %%a
    echo Product Version: %%b
  )
  subst /d K:
)

del "%temp%\ver.vbs"
pause

output:

Code: Select all

File Version:    6.1.7600.16385
Product Version: 6.1.7600.16385
File Version:    6.1.7600.16385
Product Version: 7.1.7600.16385
File Version:    6.1.7600.16385
Product Version: 8.1.7600.16385
Drücken Sie eine beliebige Taste . . .

Unfortunately I'm unable to reproduce your effect.

Regards
aGerman

Re: VER for the File Version number of my chosen *.EXE

Posted: 23 Jul 2011 03:09
by alan_b
aGerman wrote:I don't find the same effect. My output:

Code: Select all

 0:39:08,18 #
File Version:    6.1.7601.17514
 0:39:08,97 ##
22 cscript took  0:39:08,97 -  0:39:08,18 = 790. mSec
....
 0:41:17,59 #
File Version:    6.1.7601.17514
 0:41:18,35 ##
1 cscript took  0:41:18,34 -  0:41:17,59 = 750. mSec
Drücken Sie eine beliebige Taste . . .

Unfortunately I'm unable to reproduce your effect.

Regards
aGerman

Many thanks for working on this after midnight.

Something is wrong with my x64 bit Windows 7 Ultimate.
I will have to get stuck into some maintenance.

After I posted last night the system crashed and when I rebooted it suggested I used Safe Mode.
I chose Normal and all seemed well until I looked in the event log.
Since 21/07/2011 there have been 90 off "Ntfs error event ID 55" with the description
The file system structure on the disk is corrupt and unusable. Please run the chkdsk utility

I am surprised that I was not notified of any such problem.
This started before you posted any code.

When I launch Windows Explorer it sometimes takes 4 or 5 seconds to appear.
I never noticed any delay until a couple of weeks ago.

I think memory testing, chkdsk, and SFC are in my immediate future.
I may be gone a while ! ! !

Regards
Alan

Re: VER for the File Version number of my chosen *.EXE

Posted: 28 Jul 2011 15:07
by alan_b
aGerman wrote:I don't find the same effect. My output:
Unfortunately I'm unable to reproduce your effect.

Regards
aGerman

Many thanks for your patience, efforts, and your test code that used Subst.

I have adapted your code and in 1 second it performs 4 cycles of reading and displaying the version string of each executable held in two different folders.

I find that it does a perfect job in about 130 mSec most of the time, but at 33 second intervals it takes 2410 to 2450 mSec.

I am now more than satisfied that I am always given the correct answers, it is just "bad luck" that I sometimes have to wait longer than normal.

I now find I can avoid these 2+ second delays by unplugging the Ethernet cable to the Internet Router.
With the router disconnected it makes no difference if the Comodo Firewall is fully Disabled or Block-All,
either way no problem so long as Comodo Defense+ and Anti-Virus are fully disabled.
If however Defense+ is set to Safe mode then Comodo causes very frequent intervals each exceeding 1 second.

Till now when doing any "serious" operations such as partition management under Live Windows, Defragging, etc.;
I have always switched the Comodo configuration of A.V., Defense+, and Firewall each from normal protection levels,
setting Firewall to Block-All, and A.V., Defense+ to disabled, and nothing bad happened, and Comodo took no action.

I strongly suspect that Cscript is trying to send messages out to the Internet whilst it runs,
and the Comodo Firewall takes no action when Ethernet is unplugged,
but when the Ethernet is connected then Comodo plugs the hole,
or could it be some sort of Plug-n-Play where Windows is looking every 33 seconds for an Internet Play Mate ?

Either way I now know that Cscript is giving perfect answers regardless of 2+ seconds of occasional standstill,
so I can now perform long overdue investigations,
and look at Cscript/Internet/Firewall interactions later on.

I used two different versions of AutoRuns.exe to give me different version strings, not having a hex editor to hand.
They have versions 9.21.0.0 and 9.57.0.0
This is the start of my code output to Version.txt, showing the first use of Cscript suffers a delay of 2450 mSec

Code: Select all

9997 1  9:52:55.43 
0 099  9:52:55.43  "      Initial timing":- TOOK 9:52:55.43 - 9:52:55.43 = 00 mSec
245 100  9:52:57.88 9.21.0.0 "Delay timing":- TOOK 9:52:57.88 - 9:52:55.43 = 2450 mSec
12 101  9:52:58.02 9.57.0.0 "Delay timing":- TOOK 9:52:58.00 - 9:52:57.88 = 120 mSec
14 102  9:52:58.14 9.21.0.0 "Delay timing":- TOOK 9:52:58.14 - 9:52:58.00 = 140 mSec
13 103  9:52:58.27 9.57.0.0 "Delay timing":- TOOK 9:52:58.27 - 9:52:58.14 = 130 mSec
12 104  9:52:58.39 9.21.0.0 "Delay timing":- TOOK 9:52:58.39 - 9:52:58.27 = 120 mSec 


After sorting in reverse order to Version.lst

Code: Select all

9999   SUMMARY RESULT  Total Test Duration:-  9:55:01.43 -  9:52:55.43 = 126000 mSec 
9998 2  9:55:01.43
9997 1  9:52:55.43
245 100  9:52:57.88 9.21.0.0 "Delay timing":- TOOK 9:52:57.88 - 9:52:55.43 = 2450 mSec
243 506  9:54:02.55 9.21.0.0 "Delay timing":- TOOK 9:54:02.55 - 9:54:00.12 = 2430 mSec
242 303  9:53:30.18 9.57.0.0 "Delay timing":- TOOK 9:53:30.17 - 9:53:27.75 = 2420 mSec
241 714  9:54:34.81 9.21.0.0 "Delay timing":- TOOK 9:54:34.81 - 9:54:32.40 = 2410 mSec
21 587  9:54:14.10 9.57.0.0 "Delay timing":- TOOK 9:54:14.10 - 9:54:13.89 = 210 mSec
20 336  9:53:35.00 9.21.0.0 "Delay timing":- TOOK 9:53:35.00 - 9:53:34.80 = 200 mSec 


CMD.EXE process spent more than 2 seconds extra at 9:52:57.88, 9:53:30.18, 9:54:02.55, and 9:54:34.81
Simultaneously another CMD.EXE process was running a BAT script that regularly pinged at 1050 mSec,
even during those 4 long pauses, e.g.

Code: Select all

132 TOOK 9:53:28.97 - 9:53:27.92 = 1050 mSec 
133 TOOK 9:53:30.01 - 9:53:28.97 = 1040 mSec
134 TOOK 9:53:31.06 - 9:53:30.01 = 1050 mSec
135 TOOK 9:53:32.10 - 9:53:31.06 = 1040 mSec
136 TOOK 9:53:33.15 - 9:53:32.10 = 1050 mSec
137 TOOK 9:53:34.19 - 9:53:33.15 = 1040 mSec
138 TOOK 9:53:35.24 - 9:53:34.19 = 1050 mSec
139 TOOK 9:53:36.28 - 9:53:35.24 = 1040 mSec

So obviously there are plenty of spare CPU cycles available for use.

This is my Version.Bat

Code: Select all

@echo off &setlocal EnableDelayedExpansion
SET T0=%TIME%
echo 9997 1 %T0% > %~dpn0.txt

(
  echo Set objFSO = CreateObject^("Scripting.FileSystemObject"^)
  echo Set objShell = CreateObject^("Shell.Application"^)
  echo Set objFolderItem = objShell.Namespace^(objFSO.GetParentFolderName^(WScript.Arguments^(0^)^)^).ParseName^(objFSO.GetFileName^(WScript.Arguments^(0^)^)^)
  echo WScript.Echo objFolderItem.ExtendedProperty^("FileVersion"^) ^& ";" ^& objFolderItem.ExtendedProperty^("ProductVersion"^)
)>%~dpn0.vbs

set "filename=K:\autoruns.exe"
ECHO %T0% %TA% %TIME%
CALL :DURATION %T0% %TIME% 099 "      Initial timing":-

for /l %%i in (100,1,900) do (call :showver & CALL :DURATION !TA! !TIME! %%i "Delay timing":- )

echo 9998 2 %TIME% >> %~dpn0.txt
SET Ver_F=
CALL :DURATION %T0% %TIME% 9996 "Total Delay Duration":
echo 9999   SUMMARY RESULT  Total Test Duration:-  %TA% - %T0% = %T2%0 mSec
echo 9999   SUMMARY RESULT  Total Test Duration:-  %TA% - %T0% = %T2%0 mSec >> %~dpn0.txt
SORT /R %~dpn0.txt /O %~dpn0.lst
del %~dpn0.vbs
pause
GOTO :EOF

:showver
IF "%N%" EQU "1" (SET N=2) ELSE SET N=1
subst K: D:\test\T%N%
for /f "tokens=1,2 delims=; eol=" %%a in ('cscript //nologo %~dpn0.vbs "%filename%"') do (SET Ver_F=%%a)
subst /d K:
GOTO :EOF

:DURATION %1 %2
SET TA=%2
FOR /F "tokens=1-4 delims=:." %%d in ("%1") do SET /A T1=%%d*360000+1%%e*6000+1%%f*100+1%%g-610100
FOR /F "tokens=1-4 delims=:." %%d in ("%2") do SET /A T2=%%d*360000+1%%e*6000+1%%f*100+1%%g-610100-%T1%
FOR %%o in (CON %~dpn0.txt) DO ECHO %T2% %3 %TIME% %Ver_F% %4 TOOK %2 - %1 = %T2%0 mSec >> %%o


Regards
Alan