Jump to content

Help with WinSCP


 Share

Recommended Posts

Hi there anyone out there who has background with WinSCP?

i am trying to get a file from an FTP server and i have saved the username and password so i can log in directly with command prompt.

i used this code below but i cant get the file

run('cmd /k winscp.exe /command "open "testFTP@123.45.67.89/TestFolder/Folder1/"" "get "*.txt" "C:\Test\" " .\"',"C:\Program Files\WinSCP\")

Would appreciate your comments on this.

Thank You

<<..>>

Work smarter not harder.My First Posted Script: DataBase

Link to comment
Share on other sites

Hi there after hours of searching and reading i've found a working code to transfer files from local directory to remote directory(via ftp)

this code works well when i enter it to cmd.exe

C:\testfolder\Output>"C:\Program Files\Winscp\winscp.exe" /command "open "test@123.456.78.90/Folder1/"" "put "-delete" *.txt"

the problem with this one is that it only gets txt files on the working directory which is C:\testfolder\Output

so to translate that what i did in autoit was this:

$loc = Chr(34) & "C:\Program Files\Winscp\winscp.exe" & Chr(34)
run("cmd /k " & $loc & '/command "open "ssibrs@172.16.16.29/company1/incoming/"" "put "-delete" *.236"\Output"',"C:\MoneyGram\Output")

but i am getting an error 'C:\Program' is not recognized as an internal or external command,

operable program or batch file.

i think i know the problem resides with the double qoutes but i've already added Chr(34) for double quotes :)

Work smarter not harder.My First Posted Script: DataBase

Link to comment
Share on other sites

You still have problems with mismatched quotes and missing spaces between parameters.

If you run this in Scite all should become clear.

$loc = Chr(34) & "C:\Program Files\Winscp\winscp.exe" & Chr(34)


;~ Run("cmd /k " & $loc & '/command "open "ssibrs@172.16.16.29/company1/incoming/"" "put "-delete" *.236"\Output"')
$cmd = "cmd /k " & $loc & '/command "open "ssibrs@172.16.16.29/company1/incoming/"" "put "-delete" *.236"\Output"'
ConsoleWrite($cmd)

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Link to comment
Share on other sites

yeah i figured that would be the problem even tried doing this

Run("cmd /C " & "C:\Program Files\Winscp\winscp.exe" & " /command " & '"open "' & "brsftp@186.19.43.19/company1/incoming/" & '""' &' "put "' & "-delete" & '" *.txt"',"C:\Output")

but still having the same issue. if i place only ("cmd /C " & "C:\Program Files\Winscp\winscp.exe") it works fine but after adding the next codes i still have the same error.

in the end i managed to solve this by moving WinSCP folder to another directory without spaces ie "Program Files" :)

Edited by Ace08

Work smarter not harder.My First Posted Script: DataBase

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...