Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

FileCreateShortcut problems on Windows 7 64bit

$
0
0
Hi,
I have a strange problem when my 32bit script is run on a 64bit machine.

Firstofall: the same code works fine for 32bit machines.

This is supposed to be one 32bit script running with administrative rights on several OSses which installs software and creates shortcuts.


$DestPath=@ProgramFilesDir & "\myapp"
$ExeFile=$DestPath & "\SomeProgram.exe"

$ShortcutTxt ="some Text"
$ShortcutPath=@ProgramsCommonDir & "\My App"
$ShortcutParameter=""
$IconFile=$DestPath & "\MYICON.ico"

; This seems to have no effect - though I get the MsgBox ...
If @OSArch="X64" Then
 Msgbox (0,0, @OSArch)
 $IconFile=$ProgramFilesX86 & "\My App\MYICON.ico"
EndIf

If FileExists($ExeFile) Then
 DirCreate($ShortcutPath)
 $Ret=FileCreateShortcut ($ExeFile, 
 $ShortcutFullPath, 
 $DestPath, 
 $ShortcutParameter, $ShortcutTxt, 
 $IconFile, "", 0) 
EndIf


With this, I end up with an Icon pointing to the correct EXE-File in "C:\Program Files (x86)\myapp\MyApp.exe" - but the Icon's wrong.
When I try to change the icon manually I get the message "%ProgramFiles%\myapp\MYICON.ico" not found. That's right - the icon is located in %ProgramFilesX86% which resolves to "C:\Program Files (x86)"

Btw, it makes no difference if I use

$IconFile=$DestPath & "\MYICON.ico"
or
$IconFile=$ProgramFilesX86 & "\My App\MYICON.ico"
or
$IconFile=C:\Program Files (x86) & "\My App\MYICON.ico"

I always end up with the icon pointing to %ProgramFiles% :-(

Any ideas? Workarounds? Whatever ...

ciao
anthelie

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>