Orangevolt ANT Tasks » Tasks » Win32 related tasks » win32.registry » Element exists
Element existsElement delete

2.12.2.1.1.  Example

build.xml
<?xml version="1.0"?>  
      
  <project basedir="." name="myapp" default="main">
    <taskdef classpath="orangevolt-ant-tasks-1.3.2.jar" resource="com/orangevolt/tools/ant/taskdefs.properties"/>
      
    <target name="main">
          
      <win32.registry root="HKEY_LOCAL_MACHINE" key="SOFTWARE">  
          <!--
            softwareExists will be set if
            HKEY_LOCAL_MACHINE\SOFTWARE exists
          -->
        <exists property="softwareExists"/>  
            
          <!--
            rtExists will be set if
            HKEY_LOCAL_MACHINE\SOFTWARE\Orangevolt exists
          -->      
        <exists property="rtExists" subkey="Orangevolt"/>
            
          <!--
            testExists will be set if
            HKEY_LOCAL_MACHINE\SOFTWARE\Orangevolt exists
            and the subkey has an entry "test"
          -->              
        <exists property="testExists" subkey="Orangevolt" entry="test"/>
      </win32.registry>
        
      <echo message="softwareExists=${softwareExists}"/>
      <echo message="rtExists=${rtExists}"/>
      <echo message="testExists=${testExists}"/>
    </target>
  </project>