reg query problem

Discussion in 'Scripting' started by McRip, May 4, 2012.

  1. McRip

    McRip MDL Addicted

    Aug 15, 2011
    935
    3,416
    30
    #1 McRip, May 4, 2012
    Last edited by a moderator: Apr 20, 2017
    What the heck am I doing wrong?

    Code:
    @echo off
    
    reg query hklm\Software\Microsoft\Windows\CurrentVersion\Uninstall\Test /f  "UninstallString" /s >>"%temp%\uninst.txt"
    reg query hklm\Software\Microsoft\Windows\CurrentVersion\Uninstall\Test /f  "InstallLocation" /s >>"%temp%\location.txt"
    
    for /f "delims=\ tokens=2" %%a in ('type "%temp%\uninst.txt"') do ("%%a")
    for /f "delims=\ tokens=2" %%a in ('type "%temp%\location.txt"') do (rd /s /q "%%a")
    
    PAUSE
    
    '"Software"' is not recognized as an internal or external command,
    operable program or batch file.
    '"Program Files (x86)"' is not recognized as an internal or external command,
    operable program or batch file.
    '"Software"' is not recognized as an internal or external command,
    operable program or batch file.
    '"Program Files (x86)"' is not recognized as an internal or external command,
    operable program or batch file.
    The system cannot find the file specified.
    The system cannot find the file specified.
    The system cannot find the file specified.
    The system cannot find the file specified.
    Press any key to continue . . .
     
  2. McRip

    McRip MDL Addicted

    Aug 15, 2011
    935
    3,416
    30
    #2 McRip, May 4, 2012
    Last edited by a moderator: Apr 20, 2017
    (OP)
    I got it.

    Code:
    @echo off
    
    for /F "Tokens=3*" %%a in ('reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Test /v InstallLocation') do set xpath=%%a %%b
    RD /S /Q "%xpath%"