Options

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

## Got it for now

Thank you Martin. I wasn't able to actually transfer files with my permissions so I never saw the generate code part.

Sorry for the continued questions :wink:

The answers were helpful though for me to get where I needed to go and continue to search around. If I run into any more problems I will let you know.

Thanks
martin

## Re: OK So....

Sure, you can use a full path in the put command, like put S:\*.* /remote/path/. Or use the lcd command before the upload, like lcd S:\ ... put *.* /remote/path/. Again, that's what the generated script does for you already, had you used the correct directories to generate it!

## OK So....

In Task Scheduler I have it opening WinSCP, then in the arguments part I inserted the ftp:// with where I want to connect to.
It opens up correctly, but I am in the wrong directory for the documents I need to upload.

Is there a way to in the arguments put me in for example the S Drive on my PC?
Or is there a way to just upload straight from where I want to take the documents from and upload them without being in the correct drive?

Thanks
martin

Sure, because, all that script does is it opens a session and exits.
Possibly you wanted to generate a transfer script?
https://winscp.net/eng/docs/ui_generateurl

So this is the code that WinSCP generated for me with the personal information *'ed out.

When I run the batch file it says,
Connecting to sftp.******.com ...
Connected
Starting the session...
Session started.
Active session: [1] **********@sftp.****.com
Success

And then after this it just closes and nothing else happens.
Any ideas on how I can move forward with this problem?

Thanks

@echo off

"C:\Program Files\WinSCP\WinSCP.com" ^
/log="C:\writable\path\to\log\WinSCP.log" /ini=nul ^
/command ^
"open ftp://**************:***********@sftp.******.com/" ^
"exit"

set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
echo Success
) else (
echo Error
)

exit /b %WINSCP_RESULT%
martin

## Re: Task Scheduler/Automation Scripting Question

You do not want to automate the GUI ("click a button"), you need to write a script.

You can have WinSCP GUI generate the script for you (even for the transfer, not just the login):
https://winscp.net/eng/docs/ui_generateurl#script