Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- It looks like there are a few issues with your script. Here are some suggestions to fix them:
- 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.
- 2. **Command Syntax**: The `open` command should be properly formatted. The URL should be part of the `open` command, not a separate command.
- 3. **Path and Filename**: Ensure that the paths and filenames are correctly specified and exist.
- Here's a revised version of your script:
- ```batch
- "C:\Program Files (x86)\WinSCP\winscp.com" /command ^
- "open sftp://[email protected]/ -passphrase=\"R&A_sftp2024\" -privatekey=\"F:\NHSFTP\pvt20240703ver2.ppk\"" ^
- "option confirm off" ^
- "cd /uploads" ^
- "put F:\NHSFTP\DataExtracts\SampleArchive.7z" ^
- "exit"
- ```
- ### Key Changes:
- - **Escaping Quotes**: The passphrase and private key paths are enclosed in escaped quotes (`\"`).
- - **Command Continuation**: Each command is separated by a caret (`^`) to indicate continuation on the next line.
- ### Additional Tips:
- - **Check Paths**: Verify that the paths to the private key and the file to be uploaded are correct.
- - **Run as Administrator**: Ensure you have the necessary permissions to execute these commands.
- If you still encounter issues, you might want to check the [WinSCP command-line documentation](https://winscp.net/eng/docs/commandline) for more details¹.
- Let me know if this helps or if you need further assistance!
- Source: Conversation with Copilot, 29/07/2024
- (1) Command-line Options :: WinSCP. https://winscp.net/eng/docs/commandline.
- (2) WinSCP Command-Line Simplified : Your Complete Reference - ATA Learning. https://adamtheautomator.com/winscp-command-line/.
- (3) Execute wincsp command line arguments from within R. https://stackoverflow.com/questions/52556117/execute-wincsp-command-line-arguments-from-within-r.
- (4) Scripting and Task Automation :: WinSCP. https://winscp.net/eng/docs/scripting.
- (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.
- (6) cp command :: WinSCP. https://winscp.net/eng/docs/scriptcommand_cp.
- (7) en.wikipedia.org. https://en.wikipedia.org/wiki/WinSCP.
Advertisement
Add Comment
Please, Sign In to add comment