1

I have a .bat file that is attempting to reach a folder with spaces in the name. I am unable to change the name of the folder.

The code will move files in the folder to another folder. All that works...I just can't read the folder with spaces.

My coding skills are minimal. I've tried double quotes around the folder path.

put -delete C:\Users\Server\Desktop\BrightreeERN\Send Commercial to Brightree\Receive from Brightree*" ^

I would expect that we can reach the folder with spaces in the name in order for the code to complete it's task.

Edit Here's the whole thing, I've tried double quotes as shown and it still doesn't work:

"c:\Program Files (x86)\WinSCP\WinSCP.com" ^
    /log="C:\Users\Server\Desktop\WinSCP.log" /ini=nul ^
    /command ^
    "open sftp://{Edited for privacy}""" ^
    "cd /SendFiles" ^
    "put -delete "C:\Users\Server\Desktop\BrightreeERN\Send Commercial to Brightree\Receive from Brightree*"" ^
    "exit"
Compo
  • 36,585
  • 5
  • 27
  • 39
J_House_
  • 11
  • 1
  • 1
    Usually you would enclose paths containing spaces with doublequotes, what you've posted isn't. – Compo Apr 20 '19 at 11:16
  • Here's the whole thing: I've tried double quotes as shown and it still doesn't work "c:\Program Files (x86)\WinSCP\WinSCP.com" ^ /log="C:\Users\Server\Desktop\WinSCP.log" /ini=nul ^ /command ^ "open sftp://{Edited for privacy}""" ^ "cd /SendFiles" ^ "put -delete "C:\Users\Server\Desktop\BrightreeERN\Send Commercial to Brightree\Receive from Brightree\*"" ^ "exit" – J_House_ Apr 20 '19 at 12:35
  • Your example is still not doublequoted correctly, to include a literal double-quote you need to use two double-quotes sequentially: `"%ProgramFiles(x86)%\WinSCP\WinSCP.com" ^ /log="C:\Users\Server\Desktop\WinSCP.log" /ini=nul /command ^ "open sftp://{Edited for privacy}" ^ "cd /SendFiles" ^ "put -delete ""C:\Users\Server\Desktop\BrightreeERN\Send Commercial to Brightree\Receive from Brightree*""" ^ "exit"`. _(obviously each caret is the last character on each line)_. I have added your comment content to your question, you can therefore delete your comment. – Compo Apr 20 '19 at 14:33
  • Real duplicate of this question is [Use path with spaces in batch file using WinSCP](https://stackoverflow.com/q/46154795/850848). – Martin Prikryl Apr 22 '19 at 18:36

0 Answers0