-{ a hewer of maps }-

Determine Windows Version

Who would have thought a simple question like "what version of windows am I running under?" would be so complicated?

This stub retrieves the number as a string. A complete working script which parses ver and responds accordingly is attached as winver2.cmd. For practical purposes you might be better off with Simon Sheppard's approach.

~~~~ {.prettyprint} @echo off for /f "tokens=2 delims=[]" %%x in ('ver') do set WINVER=%%x set WINVER=%WINVER:Version =% echo CMD version is %winver% ~~~~

A one liner for the major number (reg.exe not always available, XP and newer I think):

reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CurrentVersion
References
Windows Version Table

Scraped from http://en.wikipedia.org/wiki/Microso...ne_of_releases

Product name

Current Version / Build

Windows 1.01

1.01

Windows 2.03

2.03

Windows 2.10

2.10

Windows 2.11

2.11

Windows 3.0

3.0

Windows 3.1x

3.1

Windows For Workgroups 3.1

3.1

Windows NT 3.1

NT continue.

CALL ss64.com for windows scripting help

Once again I find myself a slightly better Windows script writer thanks the excellent reference pages provided by ss64.com. The particular situation I was stumped by, is wanting to be able to set a variable to the contents of another variable rather than the variable name. The answer? Use 3 percent signs in a loop.

:: Notice that to evaluate the contents of %pc1%
:: requires triple%’ symbols i.e CALL SET _pc_name=%%%_pc_name%%%

This is one CALL I’m very happy to have made.

What was my goal? To estimate the number of indexable documents in use on our shared departmental fileserver, in order to get an idea of what size of Google Mini or search continue.

Search PATH for duplicates

A recent thread on the osgeo4w mailing list prompted me to scratch an itch I’ve encountered a few times: trying to figure out if there is more than one executable DLL or EXE in the search path with the same name. The result is dupe-search.bat. Invocation is a simple dupe-search [dir to look for dupes of], example:

dupe-search c:\osgeo4w\bin

Results are saved in %temp%\dupes.txt

It’s not all that intelligent, there is no effort to avoid text files for example, but it works well enough for what it does (for me anyway). The most significant thing I learned, had me scratching my head for a couple of hours, was that a continue.