After generating winscp.inf, if you use a general installation script (like above), edit the line "DIR=C:\Program Files (x86)\WinSCP" to "DIR=" in order to force the intaller to install into its standard installation directory.
Furthermore the "remove-action" should be edited.
== WinSCP 4.1.x ==
Use the following XML file for silent installation:
<source lang="xml">
<package
id='WinSCP'
name='WinSCP'
revision='415'
priority='0'
reboot='false'>
<check type='uninstall' condition='exists' path='WinSCP 4.1.5'/>
<install cmd='%SOFTWARE%\winscp\winscp415setup.exe /VERYSILENT /NORESTART /LOADINF="%SOFTWARE%\winscp\default.ini"'/>
<upgrade cmd='%SOFTWARE%\winscp\winscp415setup.exe /VERYSILENT /NORESTART /LOADINF="%SOFTWARE%\winscp\default.ini"'/>
<remove cmd='"%ProgramFiles%\WinSCP\unins000.exe" /VERYSILENT'/>
</package>
</packages>
</source>
WinSCP uses an InnoSetup installer. The installation is described in the WinSCP [http://winscp.net/eng/docs/installation#automating_installation documentation]. Basically you need to execute
<pre>
winscp406setup.exe /SAVEINF="default.inf"
</pre>
== WinSCP 3 ==