How to add ini file to iss script for Custom Installation

Advertisement

russds
Joined:
Posts:
1
Location:
Orange County

How to add ini file to iss script for Custom Installation

Hello, I've read through the documentation, and got everything working, except I can't seem to get my session information into the .iss file, and into my Installer. Ultimately I would like hostname: xyz.com, username: %username%.

I tried doing it via the [Registry] section like:
[Registry]
#define RegistryKey "Software\Martin Prikryl\WinSCP 2"
; Configure hostname/username
Root: HKCU; SubKey: "{#RegistryKey}\Sessions\Server"; ValueType: string; \
  ValueName: "HostName"; ValueData: "xyz.com"
Root: HKCU; SubKey: "{#RegistryKey}\Sessions\Server"; ValueType: string; \
  ValueName: "UserName"; ValueData: %username%
; Prevent user from accidentally deleting or modifing the session
Root: HKCU; SubKey: "{#RegistryKey}\Sessions\Server"; ValueType: dword; \
  ValueName: "Special"; ValueData: 1
But that didn't work out, when I run the winscp.exe I don't see any session information. I believe because when I run the installer, I have to run it as an administrator so the registry keys are created under the Administrator account, when I run the software I'm running as a regular user, so I'm not seeing the session information in the registry keys.

So my next attempt was using an .INI file like:

WinSCP2.ini
[Configuration\Interface]
Interface=1
 
[Sessions\Server]
HostName=xyz.com
UserName=%username%
Special=1
But I can't figure out a way to tell the *.iss file to use this WinSCP2.ini file. I looked at the documentation of Inno Installer, under the [INI] command, but seems to indicate that it will create an INI file, not use an INI file that I specify. Any ideas on how I could do this?

Thank you!

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,505
Location:
Prague, Czechia

Re: How to add ini file to iss script for Custom Installation

russds wrote:

But that didn't work out, when I run the winscp.exe I don't see any session information. I believe because when I run the installer, I have to run it as an administrator so the registry keys are created under the Administrator account, when I run the software I'm running as a regular user, so I'm not seeing the session information in the registry keys.
That's true, if you are actually using a different administrator account for installation. But typically, you use the same account, just with elevated privileges.

So my next attempt was using an .INI file like:

WinSCP2.ini
Why are you using WinSCP2.ini? The INI file has to have the same (base) name as the executable, i.e. WinSCP.ini.
Also make sure you store the INI file to a writable-location [unless you really want to read-only]. I.e. to user profile folder. But with that you'll have the same problem as with registry path, if you are really using a different administrator account.
See https://winscp.net/eng/docs/config#ini

Reply with quote

Advertisement

You can post new topics in this forum