I'm trying to create a shortcut playing with variables but I can't figure out what's wrong
I got 2 variables joined in one with for instance
Local $path = FileOpenDialog($message, "C:" & "", "Select your executable (*.exe)", 1 + 4)
Local $elev = 'c:\windows\System32\cmd.exe /c start "runhigh" /high '
$target = $elev & $path
FileCreateShortcut($target, @DesktopCommonDir & "\linked.lnk", StringLeft($target,StringInStr($target,"\",0,-1)) , "" , "" , "c:\i.ico")
The problem is that a shortcut is created but instead of the target area I got the start in filled with my variable
My second problem is that when I do a shell execute of the result of $target = $elev & $path, Note that if I do a batch with the variable written manually, it's working.
Windows shortcuts have the option to check "Run as administrator" in the "advanced settings" on the tab "Shortcut"
Is it possible to use the function FileCreateShortcut() to define this? Or to use this function and modify this option afterwards? Is it possible to "read" this option's current state for a given LNK file? (FileGetShortcut() doesn't seem to offer that?)
hi guys, how are you ?? fine? good...
Here is a little question: is it possible to know whish shortcut has been used to launch my autoit app ?
i'm quite sure that there's nothing to do with autoit, but mostly windows ...
My context: i have an app accessed from the network by my user.
In my app i use FileCreateShortcut to point to \\myfileserver\myapp.exe
Soon, in october, they are going to change my fileserver, so my app will be on \myNEWfileserver\myapp.exe
So in my code, i just rewrite my shortcut on the desktop's user. Everything works fine.
BUT..some users have several shortcut for my app (they just manually create another shortcut which i don't know the name).
So maybe they don't use my shortcut but their own ...
=> i know I could list all file on desktop, and for all the .lnk i check if destination is myapp.exe and modify the path but do you see another way ?
have fun !
I am trying to launch the shortcut through autoit, but I am getting below error.
[Window Title] C:\Windows\system32\cmd.exe /c start "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\erwin\erwin Mart Server r9.8 (64-bit)\Create MartServer Service.lnk" [Content] Windows cannot find 'C:\Windows\system32\cmd.exe /c start "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\erwin\erwin Mart Server r9.8 (64-bit)\Create MartServer Service.lnk"'. Make sure you typed the name correctly, and then try again. [OK] Launching the target directly is not feasible as it is dynamic.
$r = ShellExecute(@ComSpec & " /c " & "start """& @ProgramsCommonDir & "\erwin\erwin Mart Server r9.8 (64-bit)\Create MartServer Service.lnk""")
and also Run and RUnwait
I am trying to launch a shortcut.
But I am getting a file not found error.
Even I kept a condition to check the file exist and it is there but still I am getting the below error on run command.
$release = "r10.0" $bit = "64" $erwinShortcut = @ProgramsCommonDir&"\erwin\erwin Data Modeler "& $release &" ("& $bit &"-bit)\erwin Data Modeler "& $release &" ("& $bit &"-bit).lnk" Run(@ComSpec & " /c """& $erwinShortcut &"""", @TempDir, @SW_HIDE) [Window Title] C:\ProgramData\Microsoft\Windows\Start Menu\Programs\erwin\erwin Data Modeler r10.0 (64-bit)\erwin Data Modeler r10.0 (64-bit).lnk [Content] C:\ProgramData\Microsoft\Windows\Start Menu\Programs\erwin\erwin Data Modeler r10.0 (64-bit)\erwin Data Modeler r10.0 (64-bit).lnk The specified path does not exist. Check the path, and then try again. [OK] Any suggestions?
Even I tried surrounding with both double and single quotes for the path of lnk.
And even changed the working directory to startmenu folder and also exe folder.