Rob van der Woude's Scripting Pages

News Archives 2017 Q2

 

[ Back to the current news page... ]

 

2017-06-22
GetMyPID.vbs is a piece of VBScript code to get the current script (engine)'s Process ID (PID).
The PID is displayed on screen and returned as errorlevel.
2017-06-16
DotNetFxVer.bat is a batch file I wrote to check which .NET Framework versions are installed on any specified computer.
Unlike my other similar scripts, that query the registry, this one checks mscorlib.dll's file version, making it suitable (in theory, not tested) to check all .NET Framework versions on all Windows versions since Windows 2000.
Default output is a list of full version "numbers", e.g.:
2.0.50727.8762
4.7.2053.0

With the optional /V switch (Verbose output), the batch file will try to return a description instead of the number, e.g. .NET Framework 3.5 Service Pack 1 (3.5.30729.01) instead of just 3.5.30729.01.
These descriptions are based on listings from Microsoft Support and Jonathan Parker.
Neither of these listings is complete, several 64-bit versions as well as recent versions are missing.
If the batch file cannot find a description, it will just return .NET Framework followed by the version, e.g. .NET Framework 4.7.2053.0.

Thanks Jonathan, and thanks Microsoft Support
2017-06-15
• Another update for TrueName.exe: while it still uses DIR /ADL to find reparse targets, it now checks the specified path's DirectoryInfo.Attributes for FileAttributes.ReparsePoint to detect reparse points, making it a little faster again.
2017-05-27
GetHDDStatus.ps1 has been updated: the new version skips removable drives.
2017-05-24
TrueName.exe is the C# implementation of my TrueName.bat.
Internally the compiled C# executable uses the same technique that the batch file uses to detect "reparse points": DIR /ADL
The executable is, however, much faster than the batch file!
2017-05-09
• The last couple of weeks my computer would be unusable for at least 20 minutes after logging in: the screen would freeze and/or go blank, and often a message would pop up stating the display driver had crashed and recovered.
I first suspected a recent display driver update, but restoring the old one did not solve the problem.
Then I discovered that multiple backup scripts ran simultaneously, especially if the computer had not been used for more than a day. This was solved by writing and using RunHidden.exe instead of RunNHide.exe, but the performance problem remained.
I started running Task Manager's Processes list full time and full screen on my second monitor to try and find out which processes were involved when the screen froze. This left me with only 2 suspects: the real-time virus scanner and CompatTelRunner.exe.
Googling for CompatTelRunner.exe I learned that: I tested disabling the tasks, and the performance improvement was dramatic, so this change is here to stay, at least for now.
As you may have guessed, I wrote a batch file to automate disabling these scheduled tasks: DisableCompatTelRunner.bat.
Run it without command line arguments to disable the tasks, or with the /R switch to reenable them.
2017-05-08
CheckVarsVBS.exe has been updated:
2017-05-07
CheckVarsVBS.bat has been updated: If you value performance, however, I would recommend the C# version, which was 200 times faster than the batch file in a test.
2017-05-02
• Alfred Adric reported problems when starting VBScript code, located in his "Program Files" folder, with RunNHide.exe. As it turned out, the command line parsing for non-executables removed doublequotes, so I rewrote the command line parsing code.

Thanks Alfred
• I have used RunNHide.exe myself to start scheduled backup scripts for quite some time.
The main disadvantage of using RunNHide.exe was that the task would start the backup script and immediately return errorlevel 0, while the backup script was still running. Besides no longer being able to verify the backup tasks in the Task Manager window, even worse, I could no longer limit the task to running only a single instance!
So I wrote RunHidden.exe, similar to RunNHide.exe, except it will wait for the specified command to exit and pass on its errorlevel.
• I added a fix by Patrick Miller for a common PsList related problem to my Tweaks page.

Thanks Patrick
AllHelp.vbs has been updated, it now includes the LPR command and generates its output page in HTML5.

Thanks M. Holzé for the LPR tip
2017-04-19
CheckVarsVBS.exe is an improved C# "follow-up" of the batch file of the same name.
I have been working on the batch file lately, but I found it was extremely slow, so I wrote this (fast) C# version.
The C# version will test VBScript code (pure VBScript or HTA) for declared but unused subroutines and variables. It assumes that all variables are declared using Dim statements; VBScript's own Option Explicit can handle undeclared variables.
2017-04-14
• A bug in Hardware.hta has been fixed ("variable is undefined" error messages).
And despite promising results so far, today spawned Internet Explorer windows seem to pop up in the background again, instead of in the foreground. To be continued...
2017-04-13
TrueName.bat has been updated.
I wrote it more than 10 years ago to get the true path of SUBSTituted or mapped network drives, mimicing COMMAND.COM's internal TRUENAME command.
The new version of the batch file now also returns the true path for NTFS directory junctions. To accomplish that, it uses DIR's /A:L switch on the specified path, and on its parent folder, and on that folder's parent folder, etc.
The batch file's junction functionality won't work in Windows NT 4, in that case it will just skip the test, but I doubt that will ever be a problem.
• A minor update for Hardware.hta: Thanks Russell
2017-04-06
AllHelp.vbs has been updated: it now also includes Windows 10 version 1703's addition MBR2GPT.
GetSystemMetrics.dll is a new "wrapper" DLL for the WINAPI (user32.dll) GetSystemMetrics function.
Its usage in VBScript:

Set ObjMetrics = CreateObject( "RobvanderWoude.GetSystemMetricDLL" )
' Three ways to read property values
WScript.Echo ObjMetrics.SM_CMONITORS
WScript.Echo ObjMetrics.GetPropertyValue( "SM_CMONITORS" )
WScript.Echo ObjMetrics.GetPropertyValue( 80 )
' Get the DLL's version
WScript.Echo ObjMetrics.GetVersion( )
' List all available property names
WScript.Echo ObjMetrics.ListPropertyNames( )
' List all property names and their values
Wscript.Echo ObjMetrics.ListPropertyValues( )
' Show this help text
Wscript.Echo ObjMetrics.GetHelp( )


To use this DLL it needs to be registered once; I included a batch file to register the DLL in the ZIP file.

 

 

Archived News pages
Archived news from 2017
Archived news from 2016
Archived news from 2015
Archived news from 2014
Archived news from 2013
Archived news from 2012
Archived news from 2011
Archived news from 2010
Archived news from 2009
Archived news from 2008
Archived news from 2007

 

 


page last modified: 2018-04-16; loaded in 0.0045 seconds