Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have created a batch file containing WinSCP commands to upload files in different folders. Now, file names and folder name contain blank spaces.

It's showing an error when I'm running the batch file with those files and folders. The upload is successful when there aren't any blank spaces.

Below is the batch command that I'm running:

cd \
cd C:\Program Files\WinSCP
winscp.com /command "option echo off" "option batch on" "option confirm off" "open sftp" "put C:\abc\EXCEL\RestaurantAutomation\RestaurantReport_2012120172514\x y Report_P10_0010050075.xls /abc/MG0047/System Generated/x y Report_P10_0010050075.xls" "exit"

The error that I'm getting is:

Cannot create remote file ' /Generated/x y Report_P10_0010050075.xls'.
The file path does not exist or is invalid.
Error Code:10
Request code:3
share|improve this question
add comment

3 Answers

Wrap the name-with-space with double quote again.

winscp.com /command "option echo off" "option batch on" "option confirm off" "open sftp" "put ""C:\abc\EXCEL\RestaurantAutomation\RestaurantReport_2012120172514\x y Report_P10_0010050075.xls"" ""/abc/MG0047/System Generated/x y Report_P10_0010050075.xls""" "exit"

Update: Updated the command.

share|improve this answer
    
Tried using the above suggestion. Error coming is :Unknown command 'Generated\x y Report_P10_0010050075.xls' –  Somalia Jan 25 '12 at 12:32
    
My bad. Had to add two extra quotes. Can you try now? –  Bibhas Jan 25 '12 at 12:39
    
Tried using double quotes.File or folder 'C:\abc\EXCEL\RestaurantAutomation\RestaurantReport_20121201 72514\x y Report_P10_0010050075' does not exist. –  Somalia Jan 30 '12 at 7:34
add comment

Have you tried escaping the spaces?

/abc/MG0047/System Generated/x\ y\ Report_P10_0010050075.xls

Other possibility would be to put the folders itself within quotes, but since there allready are some it might lead to confusioun.

share|improve this answer
add comment

Try it like this.

winscp.com /command "option echo off" "option batch on" "option confirm off" "open sftp" "put C:\abc\EXCEL\RestaurantAutomation\RestaurantReport_2012120172514\""x y Report_P10_0010050075.xls"" /abc/MG0047/""System Generated""/""x y Report_P10_0010050075.xls""" "exit"
share|improve this answer
    
Could you explain what your command does? It's quite long... –  Tom Wijsman Feb 7 '12 at 14:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.