Page 1 of 2

[SOLVED] Question about pushing a .exe file

Published: January 3, 2019 - 10:09 AM
by Akewl
Hello everyone,

I'm trying to do something simple, but I can't manage it :D

So I have a portable EXE file that cannot be installed, I would just like to put it in a folder like C:\test and then create a shortcut on the desktop.

To shorten my explanation, I think I have the solution:

Code: Select all

create_user_desktop_shortcut("test",target=r'C:\Ftest\test.exe',wDir=r'C:\test\\',icon=r'C:\test/test.exe')
But I can't figure out how to put my .exe file in c:\test, can you help me?

Thank you.

Re: Question about pushing a .exe file

Published: January 3, 2019 - 10:26 AM
by agauvrit
Hello,

welcome to the forum. The first step is to consult the WAPT documentation.

There's a section specifically dedicated to this topic: https://www.wapt.fr/fr/doc/wapt-create- ... -with-wapt

When creating the shortcut, you need to understand the difference between the two existing functions, but I'll let you look that up. ;)

Alexandre

Re: Question about pushing a .exe file

Published: January 3, 2019 - 11:15 AM
by Akewl
Good morning,

First of all, thank you for your welcome and the super quick and efficient response, it works! :)

The shortcut isn't working, even though I followed the documentation and added it right after the `def uninstall` command

Code: Select all

def session_setup():
  create_desktop_shortcut(r'File',target=r'C:\Program Files (x86)\File\file.exe')
:roll: :roll: :roll:

Re: Question about pushing a .exe file

Published: January 3, 2019 - 11:18 AM
by Akewl
I just found this

Code: Select all

create_shortcut(makepath(common_desktop(),'Logiciels','SketchUp 2014.lnk'),target=r'%s\SketchUp\SketchUp 2014\SketchUp.exe' %programfiles, wDir=r'%s\SketchUp\SketchUp 2014\\' %programfiles,icon=r'%s\SketchUp\SketchUp 2014\SketchUp.exe' %programfiles)

I'm testing it! :)

Re: Question about pushing a .exe file

Published: January 3, 2019 - 11:24 AM
by Akewl
Okay, I'll change them to:

Code: Select all

def session_setup():
  create_shortcut(makepath(common_desktop(),'Logiciels'),target=r'C:\Program Files (x86)\File\file.exe' %programfiles, wDir=r'C:\Program Files (x86)\File\\' %programfiles,icon=r'C:\Program Files (x86)\FilerGet\file.exe' %programfiles)
But it doesn't work; it doesn't even create the software directory on the desktop

:oops: :oops: :oops:

Any idea what my mistake was?

Thank you in advance!

Re: Question about pushing a .exe file

Published: January 3, 2019 - 11:48 AM
by Akewl
I bypassed my problem by creating it manually using the following commands:

Code: Select all

mkdirs('C:\Users\Public\Desktop\File')
mkdirs('C:\Users\Public\Desktop\File\Download')

It works now, it's my copyfile that doesn't work.

Re: Question about pushing a .exe file

Published: January 3, 2019 - 12:24 PM
by agauvrit
Good morning,

The solution:

In the user context (session_setup), you must indeed use:

Code: Select all

create_user_desktop_shortcut("test",target=r'C:\Ftest\test.exe',wDir=r'C:\test\\',icon=r'C:\test/test.exe')
This portion of the package code is only launched when the user session starts, in user context.

In the system context (install), to create a shortcut in the shared folder Users\Public\Desktop:

Code: Select all

create_desktop_shortcut("test",target=r'C:\Ftest\test.exe',wDir=r'C:\test\\',icon=r'C:\test/test.exe')
For path construction, it's best to use the `makepath` function like this:

Code: Select all

install_path = makepath(programfiles,'FilerGet')
filecopyto('monexe.exe',install_path)
Good day

Alexander

Re: Question about pushing a .exe file

Published: January 3, 2019 - 2:05 PM
by Akewl
Great, it works, thank you!

One last question: is it possible to grant non-admin rights to the created folder?

Thanks in advance.

Re: Question about pushing a .exe file

Published: January 3, 2019 - 3:21 PM
by agauvrit
Look into "icacls.exe" by searching the forum; there are threads about it, I think

Re: Question about pushing a .exe file

Published: January 3, 2019 - 4:33 PM
by Akewl
OK thanks,

I tested the following command:

Code: Select all

run([r'realtargetpath\FilerGet','/T /grant "tout le monde":r'])

But it doesn't work, hmm

Any idea what the problem is?

Thank you in advance :mrgreen: