Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

robi

it works!
Congrats
Guest

I made it like this, and it works:

WEB -> this folder contains the mirror of the files to update
WINSCP -> this contains WinSCP3.exe, WinSCP3.ini, WinSCP3.com, winscp.RND, scpcomd.txt
update.cmd -> a batch file to launch the update process.


update.cmd:
@echo OFF

cd winscp
winscp3 /console /script=scpcomd.txt
echo.
echo.
echo Update completed.
echo.
echo Dear user,
pause



scpcomd.txt:
option batch on 

option confirm off
option transfer automatic
option synchdelete on
open user:pass@my.server.com:22
synchronize remote .\..\Web /home
close
exit


This works well in any case, from any drive letter and from any sub-foler, because it uses only relative paths.
Note in
synchronize remote .\..\Web /home
the .\ changes to the current folder, the ..\ changes to parent folder.
martin

Re: Modifications are complete

KevDog wrote:

then parses the winscp.ini file in order to change the entries with the appropriate drive letter

Well, again: I have tryied it and at least in case of Puttypath, WinSCP can handle relative paths. Unless I've missed something.

The only entries that I see in the ini file that are drive letter dependent are RandomSeedFile, Puttypath, and PublicKeyFile.

Depends on what you need from it. There is also ExternalEditor and maybe bookmarks.
KevDog

Modifications are complete

In the spirit of true portability, Ive managed to make small modifications to the way both putty and winscp startup, however I need just a word or advice from the program author.

Im managed to create a winscp_portable.exe that basically first detects the drive letter from where the program is being run, and then parses the winscp.ini file in order to change the entries with the appropriate drive letter. Martin, I need to know from you just a few things: The only entries that I see in the ini file that are drive letter dependent are RandomSeedFile, Puttypath, and PublicKeyFile. I was wondering if you know of any more??? These basically are the only entries modified in the winscp.ini file by program.

Because winscp is dependent on putty, I also was able to make a putty_portable.exe frontend. Because putty stores its values in the registry under HKCU rather than in a .ini file, the frontend basically imports registry keys into the registry at the start of the program, and then exports the keys at the conclusion, and then deletes the registry keys. This way sessions can be stored and actually settings can be saved on used on a variety of different machines. The idea was inspired by a section in the putty.hlp file.

Im not sure if any one else is interested in testing these two frontends, however they truly make winscp and putty truly portable and capable of being run from a USB jump drive (or other media) where the actual drive letter is subject to change between computers or different ports on the same machine.
martin

I have not other suggestion. Just that I have tried that using relative path to Putty is no problem for WinSCP. I have also found that WinSCP is having some problem storing the random seed file at all, I'll check it later.
KevDog

I suppose use of the SUBST command is an option, however that is really not the most elegant solution. Im in the middle of writing a c program write now that will change the winscp.ini file dynamically based on discovery of the current drive letter. Im having a small problem trying to find a pattern match algorithm however, that allows me to fish out the correct options that need changing. Do you have any suggestions?
martin

Re: Using WinSCP from portable device where drive letter changes

You can choose one drive letter that is free on all computers and use 'subst' command to make it alias to your USB drive.
KevDog

Using WinSCP from portable device where drive letter changes

In the spirit of portable thunderbird and portable mozilla, Im trying to run winscp strictly from a USB jumpdrive (trying to make it truly portable). Im storing all the configuration settings in a winscp.ini file located on the jump drive.

My problem, is that when using the jump drive on different computers, I am never able to predict what drive letter will be alloted to the jump drive. Winscp stores its configurations according to absolute paths. For example here is what I pulled out of the winscp374.ini file:
PuttyPath=E:%5Cputty%5Cputty.exe

What I want putty to do is to store the settings according to relative paths. I would prefer for example if the statement above read as follows:
Putty Path = .%5Cputy%5Cputty.exe (or something similar).

I noticed that putty also stores its data in the registry under the HKCU branch with absolute paths. In the putty help manual, they suggested a workaround with batch files that would write and then delete the registry settings. My problem with their suggestion is that they referenced a needed reg file called PUTTYRND.REG, that contained the following.

[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY]

"RandSeedFile"="a:\\putty.rnd"

Again an absolute path is mentioned. I know in order to write to the registry absolute paths are needed. Does anyone know a way, preferable through a batch file, or I guess through a c executable, that could return the root drive, and then make it possible to reconstruct the above statements with the variable returned?

Thanks