Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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)


Topic review


Re: How to take a path including special char like (C:\WIN & SCP\Audit\)

This is rather a batch file question, than a WinSCP question.

The only WinSCP-specific part of this is doubling of double-quotes, but you you seem to be aware of that:

Regarding the batch-file-part: If you pass "%Localpath%" as a 4th parameter of a batch file, the %4 will contain those quotes. So you have to cater for that in your other batch file.

You want this:
  "lcd ""C:\WIN & SCP\Audit\""" ^

And as %4 contains one pair of double-quotes already, you need to use:
  "lcd "%4"" ^

Also the batch file syntax for parameters is %N, while you inconsistently sometimes have incorrectly %N% and sometimes correctly %N.

Last, you seem to have the indentation wrong:

How to take a path including special char like (C:\WIN & SCP\Audit\)

Hi Team,

I have two bat files one is to create parm parameters for Winscp and another one is for WinSCP execution.

Here the problem is first bat file is working smoothly and giving 4 parms to Winscp (i.e: USER, "remote path", "local path", "local variable").

Here my script is with example sites :

this below line is the end of example1.bat having it will trigger example2.bat with following /parms

./example2.bat %USER% %RemoteFolder% %localvariable%  "%Localpath%"

example2.bat is having below script

@echo off
"C:\Users\" ^
  /log="C:\WinsCP.log" /ini=nul ^
  /command ^
"open" ^
"lcd %4%" ^   
"cd /home/%1/drive/%2" ^
"cd output" ^
"get file1.txt %3%%TIMESTAMP#yymm%%file1.txt"   ^
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error

Here the problem is @lcd the path is not taking whenever it's having special char in the path like (C:\WIN & SCP\Audit\)

I tried to give with double quotes & single double quotes.

please help me with this.

hemanth kumar