Ace08 Posted March 29, 2011 Posted March 29, 2011 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
Ace08 Posted March 29, 2011 Author Posted March 29, 2011 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
Bowmore Posted March 29, 2011 Posted March 29, 2011 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
Ace08 Posted March 30, 2011 Author Posted March 30, 2011 (edited) 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 March 30, 2011 by Ace08 Work smarter not harder.My First Posted Script: DataBase
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now