Need help to put a file in users Docment

27 views
Skip to first unread message

Garry Martin

unread,
Nov 17, 2025, 1:49:29 PM (11 days ago) Nov 17
to innosetup
I have a script that installs OCX files. all working
I then use the code section to place app shortcuts in a folder on local pc that links to a server.
One of the apps i use has a settings file that i would like to install to the local user documents folder. But as i need to run as admin, the files keep getting put in Users/Administrator/Documents.

I have tried to use the Environ etc. does any one have a simple technique to place a file in the uses doc folder even if i rightclick and install as admin

tks

Jernej Simončič

unread,
Nov 17, 2025, 2:13:13 PM (11 days ago) Nov 17
to Garry Martin on [innosetup]

On Monday, November 17, 2025, 19:45:16, Garry Martin wrote:


I have a script that installs OCX files. all working
I then use the code section to place app shortcuts in a folder on local pc that links to a server.
One of the apps i use has a settings file that i would like to install to the local user documents folder. But as i need to run as admin, the files keep getting put in Users/Administrator/Documents.

If your script is not running with PrivilegesRequired=lowest, there is no reliable way to access any of the user directories. Install any setting file system-wide, and let user override it (also, don't put setting files to Documents, because settings are not documents).

 

-- 
< Jernej Simončič ><><><><>< https://eternallybored.org/ >


When you've got them by the balls, their hearts and minds will follow.
       -- Colson's Law

Gavin Lambert

unread,
Nov 17, 2025, 3:08:27 PM (11 days ago) Nov 17
to innosetup
On Tuesday, November 18, 2025 at 7:49:29 AM UTC+13 Garry Martin wrote:
I have a script that installs OCX files. all working
I then use the code section to place app shortcuts in a folder on local pc that links to a server.
One of the apps i use has a settings file that i would like to install to the local user documents folder. But as i need to run as admin, the files keep getting put in Users/Administrator/Documents.

Generally, the right way to handle this sort of thing is to install a template file into a regular per-machine location (if it's not easier to generate the file content programmatically), and then actually install the file to the per-user location on actual startup of the app when you detect that it's missing or outdated.

It may be trickier if you're only installing plugins or components and not a full app.

k_zeon

unread,
Nov 17, 2025, 3:17:25 PM (11 days ago) Nov 17
to innosetup
I was thinking of creating 2 installers. One as Admin and one as Non Admin.
I then cam across another issue running as Non Admin. I wanted to create a folder C:\Toolbar and then place the shortcuts here.
I then use Startallback to create a toolbar to this folder so that i have access from the taskbar.
However , even if i set  PrivilegesRequired=none  and run the setup it still asks for admin. not sue if its because i am createing shortcuts to the C driver folder

re the 1st issue, i think i will create the file on first run of my app. might be easier. tks

not sure on the 2nd issue

can anyone advise
Reply all
Reply to author
Forward
0 new messages