Script to upload folders or files does not work
Have created with the program generator 2 scripts.
1st
I get this result in the console, but it doesn't sync the folder
2nd
This comes out, but it doesn't upload the file
How can I fix it?
1st
@echo off "C:\Users\SUPER\AppData\Local\Programs\WinSCP\WinSCP.com" ^ /log="C:\ruta\editable\al\registro\WinSCP.log" /ini=nul ^ /command ^ "open sftp://diaverso.5633997f:pass@ip:2022/ -hostkey="""" -rawsettings FSProtocol=2" ^ "put D:\Scripts\FTP\myscript.txt /" ^ "exit" set WINSCP_RESULT=%ERRORLEVEL% if %WINSCP_RESULT% equ 0 ( echo Success ) else ( echo Error ) exit /b %WINSCP_RESULT%
2nd
## Necesario para PowerShell 7.3 y posteriores $PSNativeCommandArgumentPassing = "Legacy" & "C:\Users\SUPER\AppData\Local\Programs\WinSCP\WinSCP.com" ` /log="C:\Users\SUPER\AppData\Local\Programs\WinSCP\logWinSCP.log" /ini=nul ` /command ` "open sftp://diaverso.5633997f:pass@ip:2022/ -hostkey=`"`"ssh-ed25519 `"`" -rawsettings FSProtocol=2" ` "put D:\Scripts\FTP\myscript.txt /" ` "Su orden 2" ` "exit" $winscpResult = $LastExitCode if ($winscpResult -eq 0) { Write-Host "Success" } else { Write-Host "Error" } exit $winscpResult
How can I fix it?