Jump to content

Recommended Posts

Posted

I would like know how can I copy a application, let's say chrome.exe, to desktop to create a shortcut and also edit the target path?

Thanks

  • Moderators
Posted

gahhon,

Why do you want to create a shortcut which actually points to another path than the original?

M23

P.S. And just to be absolutely clear - this is the Mod team determining the legality of the thread, so everyone else please keep out.

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted
  On 1/30/2019 at 3:28 PM, Melba23 said:

gahhon,

Why do you want to create a shortcut which actually points to another path than the original?

M23

P.S. And just to be absolutely clear - this is the Mod team determining the legality of the thread, so everyone else please keep out.

Expand  

Sorry for the late respond.

Because I have a Portable Chrome and a custom made Chrome Extension. So I would like to create a Shortcut for Portable Chrome to desktop and edit the target path to add --kiosk "URL". So when the user launch the Portable Chrome shortcut at desktop will open the Chrome Browser as Kiosk mode and redirect based on URL.

I also will lock the Portable Chrome folder by setting the accessibility, so that user can't launch normal Portable Chrome to disable/uninstall the custom made Chrome Extension.

As I know, Portable Chrome & Google Chrome will not be merge as they will be like standalone browser application. So whatever extensions I added at Chrome Portable will not auto add into Google Chrome.

  • Moderators
Posted

gahhon,

Understood - happy for the thread to remain open.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted (edited)
  On 1/31/2019 at 3:30 PM, Melba23 said:

gahhon,

Understood - happy for the thread to remain open.

M23

Expand  

Appreciated!

So now I am able to create the shortcut to desktop via FileCreateShortcut function, but how can I edit the target's path so that I can add more argument to enable kiosk mode.

FileCreateShortcut($DIR_WA_FOLDER & '\GoogleChromePortable.exe', @DesktopDir & '\ChromePortable.lnk')

 

Edited by gahhon
Posted (edited)

Hi gahhon,
I guess you'll have to use a 4th parameter in FileCreateShortcut command, the "args" parameter (additional file arguments). Here is a script that helped another user, using the args parameter, it could help you too after reworking it a bit :

#include <FileConstants.au3>

Local $path = FileOpenDialog("Choose your exe", "C:\", _
    "Select your executable (*.exe)", $FD_FILEMUSTEXIST)
If @error Then Exit
Local $elev = ' /c start "runhigh" /high '
Local $target = $elev & chr(34) & $path & chr(34)

FileCreateShortcut("C:\Windows\system32\cmd.exe", _
    @DesktopDir & "\linked.lnk", _
    StringLeft($path, StringInStr($path, "\", 0, -1)), _
    $target, _
    "tooltip here", _
    "C:\i.ico")

ShellExecute("C:\Windows\system32\cmd.exe", $target)

; https://www.autoitscript.com/forum/topic/195040-filecreate-shortcut/

Good luck :)

Edited by pixelsearch

"I think you are searching a bug where there is no bug... don't listen to bad advice."

Posted
  On 1/31/2019 at 7:16 PM, pixelsearch said:

Hi gahhon,
I guess you'll have to use a 4th parameter in FileCreateShortcut command, the "args" parameter (additional file arguments). Here is a script that helped another user, using the args parameter, it could help you too after reworking it a bit :

#include <FileConstants.au3>

Local $path = FileOpenDialog("Choose your exe", "C:\", _
    "Select your executable (*.exe)", $FD_FILEMUSTEXIST)
If @error Then Exit
Local $elev = ' /c start "runhigh" /high '
Local $target = $elev & chr(34) & $path & chr(34)

FileCreateShortcut("C:\Windows\system32\cmd.exe", _
    @DesktopDir & "\linked.lnk", _
    StringLeft($path, StringInStr($path, "\", 0, -1)), _
    $target, _
    "tooltip here", _
    "C:\i.ico")

ShellExecute("C:\Windows\system32\cmd.exe", $target)

; https://www.autoitscript.com/forum/topic/195040-filecreate-shortcut/

Good luck :)

Expand  

Awesome. It does the trick. Thanks for the helps!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...