• 0

Getting Windows revision number


Question

I'm writing a batch file and need to get the revision number of windows (for example, 2180 for xp sp2 final)..

Writing the code is not a problem, I just can't find the information where I know it will be in everyone's xp and 2k3 copy..

I've searched the registry and the closest thing i could find were some internet explorer keys but then i thought about how nLite has options to remove IE from the windows cd so I'm doubting that method.. and upgrades to ie would overwrite the number.

the ver command in dos doesnt display the revision number.. so im lost..

Link to comment
Share on other sites

12 answers to this question

Recommended Posts

  • 0

i don't know for sure if its the same but perhaps you can read the version number from the shell32.dll (at least this is giving me: 6.00.2900.2149 (xpsp_sp2_rc2.040610-1520) )

i know, i know. Still have to install the final (perhaps this will resolve my WebDav issues)

Link to comment
Share on other sites

  • 0
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion contains all the info you'd want.

Not quite. It doesn't contain the service pack build/windows revision number. And in any case, can you read the registry with a batch file? :)

Link to comment
Share on other sites

  • 0

If you give us some info about where the batch file can be used, it might help... because if it will be run from within windows, then you could call a VBS file to access the registry, and pass that parameter onto the batch file.

Link to comment
Share on other sites

  • 0

I am able to read the registry through the batch file, that's not a problem.. the file will be used in a standard windows environment and sometimes safe mode with command prompt.

Getting the version number from shell32.dll was something I considered, but if Microsoft has to update shell32 for a security hole and changes the version, there might be a problem.

Link to comment
Share on other sites

  • 0
Not quite. It doesn't contain the service pack build/windows revision number. And in any case, can you read the registry with a batch file? :)

Mine does.

BuildLab - key
2600.xpsp_sp2_rtm.040803-2158

Regardless, I doubt you can access the registry with a batch unless you're an admin. I'd check either kernel32.dll's version, or shell32.dll's version.

Link to comment
Share on other sites

  • 0
Mine does.

BuildLab - key
2600.xpsp_sp2_rtm.040803-2158

you have final version of sp2, which is 2180.. there's no 2180 in that string.. I could convert xpsp_sp2_rtm to 2180, but then I have to know how all the other builds display their number in that value (including rc's, alphas, betas, sp1, xp gold, 2k3, 2k3 sp1 betas/alphas)

Link to comment
Share on other sites

  • 0

Filever.exe can read version numbers of files. If you are using this method, consider reading a non-essential file's version (such as notepad.exe), one that is unlikely to be updated without a service pack.

And yes, I'm able to read from the registry via a batch file:

If available, using the "reg" command would be much more efficient.

Link to comment
Share on other sites

  • 0

Thanks for the tips hurting and gameguy, I'll be looking at ntoskrnl.exe for the version with filever.exe ..

Now.. similar question.. how about getting the language?

Edit: I don't have access to a machine running xp home so i cant test, but according to your link, hurting, it doesnt work on home:

The following is the system requirement for FileVer:

Windows XP Professional or Windows Server 2003

Edited by todd`
Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.