[SOLVED] Question about pushing a .exe file

Questions about WAPT Packaging / Requests and help regarding Wapt packages.
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Akewl
Messages: 8
Registration: January 3, 2019 - 10:05 AM

January 3, 2019 - 10:09

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.
User avatar
agauvrit
WAPT Expert
Messages: 238
Registration: Nov 17, 2016 - 10:25
Location: Nantes
Contact :

January 3, 2019 - 10:26

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
Akewl
Messages: 8
Registration: January 3, 2019 - 10:05 AM

January 3, 2019 - 11:15

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:
Akewl
Messages: 8
Registration: January 3, 2019 - 10:05 AM

January 3, 2019 - 11:18

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! :)
Akewl
Messages: 8
Registration: January 3, 2019 - 10:05 AM

January 3, 2019 - 11:24

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!
Akewl
Messages: 8
Registration: January 3, 2019 - 10:05 AM

January 3, 2019 - 11:48

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.
User avatar
agauvrit
WAPT Expert
Messages: 238
Registration: Nov 17, 2016 - 10:25
Location: Nantes
Contact :

January 3, 2019 - 12:24

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
Akewl
Messages: 8
Registration: January 3, 2019 - 10:05 AM

January 3, 2019 - 2:05 PM

Great, it works, thank you!

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

Thanks in advance.
User avatar
agauvrit
WAPT Expert
Messages: 238
Registration: Nov 17, 2016 - 10:25
Location: Nantes
Contact :

January 3, 2019 - 3:21 PM

Look into "icacls.exe" by searching the forum; there are threads about it, I think
Akewl
Messages: 8
Registration: January 3, 2019 - 10:05 AM

January 3, 2019 - 4:33 PM

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:
Locked