set privatekeypath=c:\Projects\UploadScript\Privatekey\privatekey.ppk
set user=user
set path=/user
set scriptPath=c:\Projects\UploadScript\
set inputhPath=c:\Projects\UploadScript\Input\
%scriptPath%\App\WinSCP\winscp.exe /ini=nul /log=%~dp0\App\Logs\log_%datetime%.txt /command ^
"open sftp://%user%@server.net/ -hostkey=""ssh-rsa "" -privatekey="%privatekeypath%"" ^
"cd %path%" ^
"lcd %inputhPath%" ^
"get *.* *.* -delete -nopreservetime" ^
"close" ^
"exit"
pause
is working fine for me. But I have a free space in the folder path where the script is located.
set privatekeypath=c:\Projects\Upload Script\Privatekey\privatekey.ppk
set user=user
set path=/user
set scriptPath=c:\Projects\Upload Script\
set inputhPath=c:\Projects\Upload Script\Input\
%scriptPath%\App\WinSCP\winscp.exe /ini=nul /log=%~dp0\App\Logs\log_%datetime%.txt /command ^
"open sftp://%user%@server.net/ -hostkey=""ssh-rsa "" -privatekey="%privatekeypath%"" ^
"cd %path%" ^
"lcd %inputhPath%" ^
"get *.* *.* -delete -nopreservetime" ^
"close" ^
"exit"
pause
I am getting the error
"c:\Projects\Upload Script\" is not recognized as an internal or external command, operable program or batch file.
I tried to double quote the path, but still is not working for me.
set privatekeypath=c:\Projects\Upload Script\Privatekey\privatekey.ppk
set user=user
set path=/user
set scriptPath=c:\Projects\Upload Script\
set inputhPath=c:\Projects\Upload Script\Input\
""%scriptPath%""\App\WinSCP\winscp.exe /ini=nul /log=%~dp0\App\Logs\log_%datetime%.txt /command ^
"open sftp://%user%@server.net/ -hostkey=""ssh-rsa "" -privatekey="""%privatekeypath%"""" ^
"cd %path%" ^
"lcd ""%inputhPath%""" ^
"get *.* *.* -delete -nopreservetime" ^
"close" ^
"exit"
pause
Now I'm getting the error
The system cannot find the path specified.
Thanks for your support.