I have found this page where it is solved: <removed by admin>
That page only copies WinSCP documentation:
https://winscp.net/eng/docs/integration_putty#putty_startup_directory
I have found this page where it is solved: <removed by admin>
%ProgramFiles%\PuTTY\putty.exe -t -m "%TEMP%\putty.txt" !`cmd.exe /c echo cd "!/" ; $($SHELL) > "%TEMP%\putty.txt"`
cd "/home/user"; $($SHELL)
I wrote a little c# app to help with this, if anybody is interested.
if [ -f $HOME/pwdputtyscript.sh ]
then
source $HOME/pwdputtyscript.sh
cd $PUTTYSTARTDIR
rm -f $HOME/pwdputtyscript.sh
fi
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Diagnostics;
namespace WinSCPPutty
{
class Program
{
static void Main(string[] args)
{
//args = [user pass host dir]
string user, pass, host, dir;
if (args.Length < 3)
return;
if (args.Length < 4)
dir = "~";
user = args[0];
pass = args[1];
host = args[2];
dir = args[3];
try
{
string puttyexe = @"C:\Program Files (x86)\PuTTY\putty.exe"; //you'll need to edit the putty location as needed
string filename = System.IO.Path.GetTempPath() + "cdputty.txt";
string txt = "echo PUTTYSTARTDIR=" + dir + " > ~/pwdputtyscript.sh";
string logintxt = user + "@" + host + " -pw " + pass;
File.WriteAllText(filename, txt);
ProcessStartInfo ps = new ProcessStartInfo(puttyexe, logintxt + " -m \"" + filename + "\"");
ps.WindowStyle = ProcessWindowStyle.Hidden;
Process p = Process.Start(ps);
p.WaitForExit();
File.Delete(filename);
Process.Start(puttyexe, logintxt);
}
catch (Exception)
{
}
}
}
}
if [ -f $HOME/pwdputtyscript.sh ]
then
source $HOME/pwdputtyscript.sh
cd $WINSCP
rm -f $HOME/pwdputtyscript.sh
fi
echo WINSCP=!/ > ~/pwdputtyscript.sh
echo !/ > ~/.winscptargetdir
set WINSCP_FNAME=$HOME/.winscptargetdir
if ( -f $WINSCP_FNAME) then
cd `cat $WINSCP_FNAME`
rm -f $WINSCP_FNAME
endif
Suggestions on what aspect?
Suggestions are welcome.