Orangevolt ANT Tasks » Tasks » Win32 related tasks » win32.shortcut
win32.shortcutExcursion to the .url File Format

2.12.3.1.  examples

.url example
<?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">
          <!--
            required to fetch the windows specific directories
            into ant properties
          -->
        <win32.properties/>
          
          <!--
            creates a entry in the programs menu
            
            will be opened using the associated
            viewer program (notepad i think :-)
          -->
      <win32.shortcut
        file="${win32.personal.programs_menu}/Orangevolt/read license.url"
        url="${win32.personal.programfiles}/Orangevolt/test/license.txt"
      />
          <!--
            creates a entry in the programs menu
              
            will be opened using the associated
            viewer program (internet explorer, mozilla, opera - whatever)
          -->      
      <win32.shortcut
        file="${win32.personal.programs_menu}/Orangevolt/Go to Orangevolt.url"
        url="http://www.orangevolt.com"
      />  
          <!--
            creates favorites entry
          -->      
      <win32.shortcut
        file="${win32.personal.favorites}/Orangevolt/Go to Orangevolt.url"
        url="http://www.orangevolt.com"
      />  
        <!--
          creates a entry in the programs menu         
          the file is executed when opening
        -->
      <win32.shortcut
        file="${win32.personal.programs_menu}/Orangevolt/layxx.url"
        url="${win32.personal.programfiles}/Orangevolt/roxes-layxx-1.4-2003-10-23.exe"
        iconFile="C:\winnt\explorer.exe"
        iconIndex="0"
      />
    </target>
  </project>

.lnk example
<?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">
          <!--
            required to fetch the windows specific directories
            into ant properties
          -->
        <win32.properties/>
          
        <!-- create a .lnk shortcut in programs menu -->
      <win32.shortcut
        file="${win32.personal.programs_menu}/Orangevolt/Open notepad.lnk"
        execute="c:\winnt\notepad.exe"
      />
    
        <!--
          create a .lnk shortcut in programs menu
          (see the use embedded <execute> tag)
        -->
      <win32.shortcut
        file="${win32.personal.programs_menu}/Orangevolt/Open explorer in temp.lnk"
      >  
        <execute>
          c\winnt\explorer.exe c:\temp
        </execute>
      </win32.shortcut>
    
        <!--
          create a .lnk shortcut at the desktop
        -->
      <win32.shortcut
        file="${win32.personal.desktop}/Orangevolt/layxx.lnk"
        url="${win32.personal.programfiles}/Orangevolt/roxes-layxx-1.4-2003-10-23.exe"
      >
        <workingdirectory>
          ${win32.personal.documents}
        </workingdirectory>
        <execute>
          c\winnt\explorer.exe c:\temp
        </execute>
      </win32.shortcut>
    
        <!-- create a shortcut in send to menu -->
      <win32.shortcut
        file="${win32.personal.sendto}/Orangevolt/notepad.lnk"
      >
        <execute>
          c:\winnt\notepad.exe
        </execute>
      </win32.shortcut>
    </target>
  </project>

You can use embedded elements for workingDirectory, url and execute. See the example above.