Results 1 to 2 of 2

Thread: Problems with FOR control syntax(progarmming)

  1. #1
    ScottWright is offline Senior Member
    Join Date
    Dec 2009
    Posts
    243
    Rep Power
    3

    Default Problems with FOR control syntax(progarmming)

    When I try to read 3rd token from output of find control i only get echo %%A
    Here is what I have
    FOR /F "token=3* delims= " %%A IN ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" ^| find "productname"') do echo %%A


    Output of the reg query command similar to ProductName REG_SZ Windows XP I am attempt to find out 1st 2 token so that I can use them as variable.

  2. #2
    BakerJones is offline Senior Member
    Join Date
    Dec 2009
    Posts
    244
    Rep Power
    3

    Default

    It is promising to take out the find process by using the
    for /f loop and reg more effectively:

    Code:
    for /f "skip=4 tokens=2*" %%a in ('2^>nul reg query "HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersion" /v "ProductName"') do (
        echo %%b
    )

Similar Threads

  1. Syntax: operator T & () const;
    By cherish22 in forum Programming
    Replies: 2
    Last Post: 11-05-2009, 11:39 AM
  2. Pointer Syntax in C++
    By sheldon in forum Programming
    Replies: 0
    Last Post: 10-05-2009, 12:21 PM
  3. Command Syntax Elements
    By Cadmus4778 in forum Everything Else
    Replies: 0
    Last Post: 11-29-2008, 09:57 AM
  4. Flash Action Script - Check Syntax
    By interworld in forum Programming
    Replies: 0
    Last Post: 10-26-2008, 02:14 PM
  5. Syntax
    By techno23 in forum Programming
    Replies: 0
    Last Post: 03-26-2008, 12:30 PM

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
  •  
SEO by SubmitEdge

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48