Results 1 to 2 of 2

Thread: Batch syntax - parse registry key for info

  1. #1
    Join Date
    Jul 2009
    Posts
    1

    Batch syntax - parse registry key for info

    Hi, thanks for any help in advance..

    My goal is to parse the value "ProductID" from "HKEY_LOCAL_MACHINE\Software\Microsoft\WindowsNT\CurrentVersion" to obtain the Microsoft Product Code (represented by x in the following example:xxxxx-yyy-zzzzzzz-zzzzz). I have been working on a batch file to work with errorlevels to verify the actual version of the target OS then perform a goto.

    VER | FIND "5.1" > nul
    IF %ERRORLEVEL% == 0 GOTO ver_xp

    I have been using the above which is working, but want to modify it to see the pull that MPC to get a bit more version specific (XP home vs pro vs mediacenter)

    I have seen the likes of this next statement around and have modified it a bit...but I am having a bit of trouble with its application as it relates to my goal:

    @ECHO OFF

    FOR /F "tokens=2*" %%a in ('REG QUERY HKLM\SOFTWARE\Microsoft\"Windows NT"\CurrentVersion |FINDSTR 89587') DO IF %ERRORLEVEL% == 0
    GOTO ver_xp

    Can anyone help ? I know I am missing something in the above syntax.. its late and ive been stuck for hours..

    Thanks again!

  2. #2
    Join Date
    Jan 2009
    Posts
    1,738

    Re: Batch syntax - parse registry key for info

    Try to create a batch file which will export the registry hive, this file will be with extension .reg but you can open it with notepad as a normal text file. You can then search this reg file and accordingly perform the tasks.

Similar Threads

  1. Replies: 1
    Last Post: 19-03-2011, 01:28 AM
  2. PHP WordPress Parse Error: syntax error, unexpected $end in
    By Bisujaksha in forum Software Development
    Replies: 2
    Last Post: 22-05-2009, 09:27 AM
  3. Batch Script Text file parse
    By tator.usenet@gmail.com in forum Windows Server Help
    Replies: 5
    Last Post: 25-03-2009, 02:12 AM
  4. Batch Script to parse lines in text file
    By jntoner1@gmail.com in forum Windows Server Help
    Replies: 8
    Last Post: 28-01-2009, 04:38 AM
  5. vol info for all drives in batch or vbs
    By skipro in forum Software Development
    Replies: 1
    Last Post: 13-10-2008, 01:02 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,033,853.67249 seconds with 17 queries