martin wrote:
I have added some example to
useful script article. Let me know if it helps.
Thanks for publishing that article. I followed the instructions in that article, but unfortunately it did not work. I am a WinSCP newbie, and this is the first time that I have made a script or batch file for WinSCP; so I may have possibly done something wrong. Please let me know if I did, in fact, do something wrong.
Here is what I did.
I created MyBatch.bat file, which contains the following code:
set LOCAL=%1
set REMOTE="/MyServerFolder/%~n1%~x1"
winscp.com /script=example.txt
I placed the MyBatch.bat file in my WinSCP folder.
I created a shortcut to the MyBatch.bat file. I named the shortcut MyShortcut. I placed MyShortcut on the desktop. I placed a copy of MyShortcut in my Windows SendTo folder.
I created example.txt file, which contains the following code:
# Being intended for interactive session, we are not enabling batch mode
# Connect
open session
# Synchronize paths provided via environment variables
synchronize remote %LOCAL% %REMOTE%
I placed the example.txt file in my WinSCP folder.
I created TestFile.txt file, which contains the words "Hello World". I placed the TestFile.txt file in TestFolder on my desktop.
I then performed the following two tests separately. Test #1: I right-clicked on TestFolder and clicked Send To > MyShortcut. Test #2: I dragged TestFolder onto MyShortcut on the desktop.
Here are the results of those two tests: nothing happened, except a window (which seemed to be some sort of DOS window) appeared for just a fraction of a second during each test. In other words, both tests failed.
By the way, I have never had any problem uploading stuff to the same FTP server using drag-and-drop in the WinSCP GUI.
The WinSCP folder contains the following files (in addition to the MyBatch.bat and example.txt files mentioned above): winscp418.exe and winscp418.ini. Could those names (which are the default names) be the cause of the problem? Should I change those names to winscp.exe and winscp.ini?
The WinSCP folder is at the following local location:
C:\Program Files\WinSCP
I am using WinSCP 4.1.8 (Build 415, "Portable executable") from the hard-drive on a Windows 2000 platform.