Well I thought it was simple ..
I did this ... copied the UDF to this below Exit 1 ... and ran it. It puts a file on my desktop OK .. named G .. but it's not a .lnk .. it's a file and if you click on it the system prompts you as to what to open it with. So what did I miss?

 Code:
if exist("G:\")
  USE G: \\frafile\shared /delete /persistent
endif
$RC=wshshortcut("G:_Drive","\\frafile\shared")

Exit 1

function wshShortCut($shortcutname,$targetpath,optional $arguments, optional $startdir, optional $iconpath, optional $style,optional $description,optional $hotkey)
  dim $shell, $desktop, $shortcut, $index, $iconinfo, $iconindex,$scdir,$rc
  $wshshortcut=1
  $shell = createobject("wscript.shell")
  if $shell
    if ucase(right($shortcutname,4))=".URL" or ucase(right($shortcutname,4))=".LNK"
      ;do nothing 
    else
      if ucase(left($targetpath,5))="HTTP:" or ucase(left($targetpath,6))="HTTPS:" or ucase(left($targetpath,4))="FTP:"
        $shortcutname=$shortcutname + ".url"
      else
        $shortcutname=$shortcutname + ".lnk"
      endif
    endif
    if right($targetpath,2)=",1"
      $targetpath=left($targetpath,-2)
    else
      if instr($shortcutname,".lnk") and not exist($targetpath)
        exit 2
      endif
    endif
    if instr($shortcutname,"\")=0
      $Desktop = $shell.SpecialFolders("Desktop")
      $shortcutname=$desktop + "\" + $shortcutname
    else
      $scdir=substr($shortcutname,1,instrrev($shortcutname,"\"))
      if not exist($scdir)
        md $scdir
        if @error
          exit @error
        endif
      endif
    endif
    $shortcut = $shell.createshortcut($shortcutname)
    if $shortcut
      $shortcut.targetpath = $targetpath
      if $iconpath and instrrev($shortcutname,".lnk")
        $shortcut.iconlocation = $iconpath
      endif
      if $arguments
        $shortcut.arguments = $arguments
      endif
      if $startdir
        $shortcut.workingdirectory = $startdir
      endif
      if $style
        $shortcut.windowstyle = $style
      endif
      If $description and instrrev($shortcutname,".lnk")
	  $shortcut.description = $description
      EndIf
      if $hotkey
        $shortcut.hotkey = $hotkey
      endif
      $shortcut.save
      if @error
        exit @error
      endif
      if instrrev($shortcutname,".url") and $iconpath
        $index=instrrev($iconpath,",")
        if $index=0
          $iconindex=0
        else
          $iconindex=split($iconpath,",")[1]
          $iconpath=split($iconpath,",")[0]
        endif
        $rc=writeprofilestring($shortcutname,"InternetShortcut","IconFile",$iconpath)
        $rc=writeprofilestring($shortcutname,"InternetShortcut","IconIndex",$iconindex)
      endif
      $shortcut = 0
      $wshshortcut=0
    else
      exit @error
    endif 
  else
    exit @error
  endif 
endfunction


Edited by Mart (2014-11-20 09:32 AM)
Edit Reason: Please use code tags when posting code.