Inno Setup - puts user files in admin documents

I have several Windows 7 users who, when installing and logging in, independently request an administrator password. When this happens, Inno Setup installs a program for this user, but he places the sample data files in the administrator's document folder.

What can I do to make sure Inno Setup places the sample data in the Documents folder where it belongs?

[Files] Source: "C:\dev\Installer Files\Chess Openings Wizard 2016\Game Trees\*.*"; DestDir: "{code:GetDataDir}\Game Trees"; Flags: uninsneveruninstall recursesubdirs function GetDataDir(Param: String): String; begin { Return the selected DataDir } Result := DataDirPage.Values[0]; end; 
0
source share
1 answer

Your approach is wrong.

There are two correct ways:

You can also allow the user to choose between these two approaches.
See Make Inno Setup Installer Request Privilege Changes Only If Required .

For other similar questions, see


Having said that, you can do what you ask by executing an external copy utility ( copy , xcopy , robocopy ) using the ExecAsOriginalUser function (or runasoriginaluser flag in [Run] ).

 ExecAsOriginalUser( 'cmd.exe', '/c xcopy.exe "sourcefile" "%APPDATA%"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode); 

For more information on this approach, see the similar question Inno Setup Create a registry key for logging in (not an administrator user) .

0
source

Source: https://habr.com/ru/post/915369/


All Articles