Topic "How to add ini file to iss script for Custom Installation"

Author Message
russds
[View user's profile]

Joined: 2014-05-29
Posts: 1
Location: Orange County
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:

Code:
[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

Code:
[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!
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
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.

Quote:
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
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License