Customize default behavior of New Session launch in WinSCP

Requirements:
  • Using WinSCP, you have navigated to a folder that has a lot many sub-folders to list.  WinSCP doesn’t respond until it completes the enumeration of all the sub-folders.
  • This forces you to terminate/close the WinSCP program.  The trouble returns when you launch the WinSCP program as it again starts in the same folder where it was closed before and again becomes unresponsive.
  • This is the default behavior of WinSCP and it doesn’t leave you with any other option then to just wait for WinSCP to complete the  sub-folders enumeration.
  • Its a common practice that many website owners opt for share hosting and connect to their website folders via WinSCP.  When they navigate a level above their home folder, WinSCP ends up enumerating all the home folders available in the next level folder.

 

Solution:
  • By default, WinSCP saves its session  parameters like HostName, LocalDirectory, RemoteDirectory, UserName, and Password in registry during every exit.   The registry path is reg query “HKEY_CURRENT_USER\Software\Martin Prikryl\WinSCP 2\Sessions\<WinSCP site/session name>”
  • When you restart WinSCP and any session, it reads the same registry parameters and uses them in session establishment.
  • By changing this registry value to your home path/folder, you will get  WinSCP quickly connect to your required folder and avoids WinSCP from entering into the unresponsive state.
  • In this particular case, you require to reset the value of RemoteDirectory parameter to your home folder.

Example:

image

C:\>reg query “HKEY_CURRENT_USER\Software\Martin Prikryl\WinSCP 2\Sessions\WWEBadmin@www.mysite.com”

HKEY_CURRENT_USER\Software\Martin Prikryl\WinSCP 2\Sessions\WWEBadmin@www.mysite.com
    HostName    REG_SZ    www.mysite.com
    UserName    REG_SZ    webadmin
    Password    REG_SZ   
    LocalDirectory    REG_SZ    C:\temp\
    RemoteDirectory    REG_SZ    /home/website08953432/html/wp-content

C:\>

If RemoteDirectory value is changed to /home by any chance, your WinSCP session will tries to enumerate all subfolders in that path which can take a long while.  By manually changing it to your own website path like /home/website08953432/html/wp-content will make it to launch just fine.

Leave a Reply

Your email address will not be published. Required fields are marked *