Guest User

Untitled

a guest
Jul 29th, 2024
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. It looks like there are a few issues with your script. Here are some suggestions to fix them:
  2.  
  3. 1. **Quoting and Escaping**: Ensure that the quotes and escape characters are correctly placed. The `-passphrase` and `-privatekey` options should be within the same command.
  4.  
  5. 2. **Command Syntax**: The `open` command should be properly formatted. The URL should be part of the `open` command, not a separate command.
  6.  
  7. 3. **Path and Filename**: Ensure that the paths and filenames are correctly specified and exist.
  8.  
  9. Here's a revised version of your script:
  10.  
  11. ```batch
  12. "C:\Program Files (x86)\WinSCP\winscp.com" /command ^
  13. "open sftp://[email protected]/ -passphrase=\"R&A_sftp2024\" -privatekey=\"F:\NHSFTP\pvt20240703ver2.ppk\"" ^
  14. "option confirm off" ^
  15. "cd /uploads" ^
  16. "put F:\NHSFTP\DataExtracts\SampleArchive.7z" ^
  17. "exit"
  18. ```
  19.  
  20. ### Key Changes:
  21. - **Escaping Quotes**: The passphrase and private key paths are enclosed in escaped quotes (`\"`).
  22. - **Command Continuation**: Each command is separated by a caret (`^`) to indicate continuation on the next line.
  23.  
  24. ### Additional Tips:
  25. - **Check Paths**: Verify that the paths to the private key and the file to be uploaded are correct.
  26. - **Run as Administrator**: Ensure you have the necessary permissions to execute these commands.
  27.  
  28. If you still encounter issues, you might want to check the [WinSCP command-line documentation](https://winscp.net/eng/docs/commandline) for more details¹.
  29.  
  30. Let me know if this helps or if you need further assistance!
  31.  
  32. Source: Conversation with Copilot, 29/07/2024
  33. (1) Command-line Options :: WinSCP. https://winscp.net/eng/docs/commandline.
  34. (2) WinSCP Command-Line Simplified : Your Complete Reference - ATA Learning. https://adamtheautomator.com/winscp-command-line/.
  35. (3) Execute wincsp command line arguments from within R. https://stackoverflow.com/questions/52556117/execute-wincsp-command-line-arguments-from-within-r.
  36. (4) Scripting and Task Automation :: WinSCP. https://winscp.net/eng/docs/scripting.
  37. (5) How to connect WinSCP through command line not in GUI mode?. https://superuser.com/questions/1086278/how-to-connect-winscp-through-command-line-not-in-gui-mode.
  38. (6) cp command :: WinSCP. https://winscp.net/eng/docs/scriptcommand_cp.
  39. (7) en.wikipedia.org. https://en.wikipedia.org/wiki/WinSCP.
Advertisement
Add Comment
Please, Sign In to add comment