# Post a reply

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

martin
I do not see what does this have to do with "compatibility with WinSCP".

Anyway, Batch file is a script of cmd.exe, the same way yourscript.txt is a script of WinSCP. So if Greenshot can run WinSCP with a script, then it for sure can run even a batch file (via cmd.exe).

So instead of making Greenshot run
winscp.com /script=C:\path\to\winscpscript.txt /parameter // """{0}"""

make it run
cmd.exe /c C:\path\to\thebatch.bat """{0}"""

And the thebatch.bat would be something like I've shown above.
martin

## Re: SFTP file upload to Web Server and automatically copy it’s URL to clipboard

So create the batch file. Make it call both winscp and clip, as I have shown above (you will need to use absolute path to winscp.com, the same way the Greenshot example does. And make Greenshot call the batch file. Either it can take batch file path directly as a "Command". And if not, it should be able to take cmd.exe as the Command and /c C:\path\the_batch_file.bat as its Argument.

## Re: SFTP file upload to Web Server and automatically copy it’s URL to clipboard

OK, thank you very much Sir for this valuable pointer. Please let's go a little bit further 😊
Actually, what I'm trying to accomplish is to efficiently use WinSCP with Greenshot (most popular screenshot software).
There's a Greenshot manual https://getgreenshot.org/2013/11/07/how-to-upload-screenshots-to-a-web-server-via-ftp-scp-or-sftp/ how to securely upload a screenshot to Web Server. Works fine but no automatic insertion to clipboard. Their example doesn't use a “bat”-file, but maybe it can be used..
Of course, I also posted same question to Greenshot support forum but no response yet😬
Do you have any idea how to insert an URL in that scenario or it's not possible? 😊
Or maybe you know any other screenshot software where it can be done easier? 😵
martin

## Re: SFTP file upload to Web Server and automatically copy it’s URL to clipboard

WinSCP scripting cannot generate an HTTP URL, nor can it copy anything to the clipboard.
But after WinSCP script finishes, you can use some other tool to do that.
Assuming your script runs from a Windows batch file, which takes the filename as a parameter, you can use Windows clip tool to do that:
winscp.com /command=yourscript.txt /parameter %1echo https://example.com/%1| clip
Here’s my SFTP upload script for a single file:# Automatically abort script on errorsoption batch abort# Disable overwrite confirmations that conflict with the previousoption confirm off# Connect to server (change this to match your connection settings)open sftp://myuser:mypassword@example.com# Apache web-server directory cd "/C:/xampp/htdocs"# Upload the file to current working directoryput %1% # Disconnectclose# Exit WinSCPExit