Fast-open of PuTTY in current directory
could you add a config-attribute to Options->Preferences->Integration->Applications->PuTTY, so that the Button will open PuTTY in the current directory?
I would love it!
Greetings,
someguest
Advertisement
Advertisement
CreateProcess() with the Command
putty -ssh telnet://$ip -l $username -pw $pass
cd $dir to the Thread-ID with the PostThreadMessage function: https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-postthreadmessagew
c:\kitty\kitty.exe -ssh user@host -pw "password" -cmd "cd $REMOTE_PATH$"
Advertisement
"D:\PortableApps\KittyPortable\kitty_portable.exe" -ssh !U@!@ -pw "!P" -cmd "cd !/"
So perhaps one could make a batch file which would receive the username, hostname, and path from its command line arguments passed to it from a WinSCP Custom Command. Then it would echo3.8.3.6 -m: read a remote command or script from a file
The-moption performs a similar function to the "Remote command" box in the SSH panel of the PuTTY configuration box (see section 4.18.1). However, the-moption expects to be given a local file name, and it will read a command from that file.
cd and path to a temp file. And then run putty.exe with the username, hostname, and the temp file.
Advertisement
I've been testing this. It seems pretty unreliable. Obviously, what it does is that it simulates the keystrokes to type the command. I guess that it often starts typing too early, before the remote session starts reading; and the keystrokes end in vain.what about using KiTTY instead of PuTTY and utilizing KiTTY's ability to execute commands after login ?
at least supporting this option would be nicec:\kitty\kitty.exe -ssh user@host -pw "password" -cmd "cd $REMOTE_PATH$"
-load switch that WinSCP is using to pass all parameters to PuTTY.
This (as opposite to KiTTY simulating keystrokes) makes PuTTY instruct SSH server to start that command instead of the shell. Once that command finishes, the session is terminated. So WinSCP would have to know how to start a shell and append the shell starting command after thePutty.exe has a similar argument to run a command but it has to be read from a file and cannot be passed directly on the command-line:
cd.
I reported this to KiTTY forums and they replied that the fix for this is to increase the initial delay before it starts typing.I've been testing this. It seems pretty unreliable. Obviously, what it does is that it simulates the keystrokes to type the
command. I guess that it often starts typing too early, before the remote session starts reading; and the keystrokes end in vain.
Advertisement
Btw, theI reported this to KiTTY forums and they replied that the fix for this is to increase the initial delay before it starts typing.
https://www.9bis.net/kitty/#!pages/AutomaticCommand.md
-cmd switch cannot be combined with -load. What limits its usability for exporting sessions from WinSCP to KiTTY.
That is because whenBtw, the-cmdswitch cannot be combined with-load. What limits its usability for exporting sessions from WinSCP to KiTTY.
-load is used, it reads the cmd from the "Autocommand" data key as defined in the session.
"KittyPortable\Sessions\Default%20Settings" as "KittyPortable\Sessions\WinSCPTemporarySession".
"KittyPortable\Sessions\WinSCPTemporarySession"
HostName
UserName
Password
PublicKeyFile (if password is blank)
Autocommand
kitty_portable.exe -load "WinSCPTemporarySession"
You can use Pageant instead.In addition to the !p password custom command pattern, it would be helpful if you could also implement a WinSCP custom command pattern to pass the private key file path to a custom command line.
Advertisement
Not really. Just tried 5.2.2 beta. It will open the current session but not switch to the current directory.Implemented in 5.2.2 beta and released today :-)
[HKEY_CURRENT_USER\Software\9bis.com\KiTTY\Sessions\WinSCP%20temporary%20session]"<pathtoputty>" -load "WinSCP temporary session"
[HKEY_CURRENT_USER\Software\9bis.com\KiTTY\Sessions\WinSCP%20temporary%20session] Autocommand="cd \"$REMOTE_PATH$\""
cd "$REMOTE_PATH$"
[HKEY_CURRENT_USER\Software\9bis.com\KiTTY\Sessions\WinSCP%20temporary%20session]-cmd on command line (of which unable to pass SSH keyfile and if user doesnt want to use pageant), here is a solution to re-use already existing "Open in PuTTY (Ctrl+J)" command which already passes information through registry. Following method will add "Autocommand" registry value as well to the other registry values that WinSCP already writes in "WinSCP Temporary Session".
kitty.ini with the following contents in your WinSCP directory. Modify initdelay depending on your connection speed. I found 6 seconds to be a good Autocommand delay to work across a variety of servers.
[KiTTY] initdelay=6.0
WinSCPLaunchKittyTempsession.ahk with the following contents that you then compile into WinSCPLaunchKittyTempsession.exe in your WinSCP directory. Pre-compiled script attached.
RegWrite, REG_SZ, HKEY_CURRENT_USER, Software\9bis.com\KiTTY\Sessions\WinSCP`%20temporary`%20session, Autocommand, cd "%1%" Run, kitty.exe -load "WinSCP Temporary Session"
WinSCPLaunchKittyTempsession.exe "!/"Software\9bis.com\KiTTY
Ctrl+P). No need to create a custom command. And it works with SSH keyfiles and all as well.
Advertisement
You can post new topics in this forum