Post a reply

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

msides

Thanks for this!

This helped me fix my code. Thank you!!
Cwaldschmit

Well as a .BAT file your code isn't working. After starting up winscp.com it does nothing. When I type exit and enter the bat files continues.
martin

You have this:
C:\Users\PC0102\Desktop\cz2\WinSCP\winscp.com ^

/command ^
option batch off ^
option confirm on ^
open ftps://*:*@datatransfer.cz.nl ^     
CD Incassopartner2CZ ^
CD Input ^
put C:\Users\PC0102\Desktop\cz2\Bestanden\ /prc/Incassopartner2CZ/Input ^


And I've asked you to do this:
C:\Users\PC0102\Desktop\cz2\WinSCP\winscp.com ^
    /command ^
        "option batch off" ^
        "option confirm on" ^
        "open ftps://*:*@datatransfer.cz.nl" ^
        "CD Incassopartner2CZ" ^
        "CD Input" ^
        "put C:\Users\PC0102\Desktop\cz2\Bestanden\ /prc/Incassopartner2CZ/Input" ^
        "exit"

You are missing the indentation (leading spaces), double-quotes around commands and the exit command.
And on many lines, you have spaces after the ^. That's not allowed. The ^ must be the very last character on the line.

See Why are some WinSCP scripting commands specified in a batch file not executed/failing?

I'm attaching a fixed batch file.
Cwaldschmit

Here is the .BAT file
martin

Remove all information you do not want to share.
Cwaldschmit

I can send the bat file but I can't give you the password of the server. Is that a problem?
martin

Your batch file is still not, what I've shown you to use.

Please attach your batch file.
Cwaldschmit

Fort some reason its not opening the connection. The password does exist a & could that be the problem?
martin

You have to use the ^'s in the batch file.
Cwaldschmit

This is the result
martin

OK, assuming your batch file is called upload.bat:
Open console (cmd.exe) and type:
type upload.bat
upload.bat

And post a screenshot of the result.
Cwaldschmit

It only starts winscp in command promt but doesn't do anything else at all.
martin

I mean that you copy and paste the code from my post to a .bat file, exactly.

There's no upload.txt involved.
Cwaldschmit

How do you mean exactly?
I've been trying out some stuff atm
I got a .bat file now that activates the .txt script.
But for some reason it says
Host "upload.txt" does not exist
Cwaldschmit

I've tried out your code in CMD. And it does nothing except starting up winscp in cmd. All other commands are unknown.
martin

Re: Bat/Script file not working

Your code is just wrong.

This is the correct syntax:
"C:\Program Files\WinSCP\WinSCP.com" ^
  /log="C:\Users\PC0102\Desktop\cz2\WinSCP.log" /ini=nul /loglevel=2* ^
  /command ^
    "option batch continue" ^
    "option confirm on" ^
    "open ftps://PRC:*@datatransfer.cz.nl" ^
    "CD Incassopartner2CZ" ^
    "CD Input" ^
    "put C:\Users\PC0102\Desktop\cz2\Bestanden\* /prc/Incassopartner2CZ/Input/" ^
    "exit"
Cwaldschmit

Bat/Script file not working

Hello,

I've got the following problem. I can't get the following code to work automatic trough a .BAT file or with a script:
batch continue

option confirm on
"C:\Program Files\WinSCP\WinSCP.com" ^
  /log="C:\Users\PC0102\Desktop\cz2\WinSCP.log" /ini=nul /loglevel=2*^
  /command ^
    "open ftps://PRC:*@datatransfer.cz.nl
  CD Incassopartner2CZ
  CD Input
  put C:\Users\PC0102\Desktop\cz2\Bestanden\ /prc/Incassopartner2CZ/Input

When I put this code in my cmd it's working perfect (See log 1). When I try the same code in a .BAT file or with a .BAT file who calls on a script its only connecting to the server and isn't doing anything anymore (see log 2). Is there anyone who could help me with this problem?