I have a WinSCP session thru the UI, I copied the PS code from the main window.
I am trying to have the file that gets downloaded to automatically get copied to another drive as part of the download. It downloads on C:\Data and I want it copied to D:\Data
Ultimately I will create a daily Windows task to perform the daily download via a PowerShell.
Thanks for the reply. No error message received, I am trying to add an additional “copy” step to the download process. I will pull down the code in the correct format. I was not sure the best way to pose the question as I am not a programmer.
Hopefully this is what you asked for, this code is the output when I establish a SFTP connection to the remote host using Win SCP. I want to pull down a single file, the only one in the directory, and copy to a different drive on the server. I want to save the code as a powershell .ps and then execute it daily as a Windows scheduler job.
It’s not what I asked for no. I asked for your share code to be “formatted” in a readable way.
Go back and click the link I provided which has a demo video on how to format code.
Edit your post(s), select the text representing code then find the “preformatted text” button on the toolbar to format everything.
I replaced all of the double quote characters with the correct ASCII characters but otherwise this is unmodified CMD code. This is not PowerShell.
Really it seems like the bulk of what you’re trying to accomplish is done within the CLI use of WinSCP anyway. This does not seem like a PowerShell forum issue.
You might check our the WinSCP Forum or maybe just review the documentation for command line usage.
To post preformatted text, look at the icons either at the top, or bottom, of the post. Click the one that looks like a circle with a “+” in the middle and select the choice that says “</> Preformatted text”. That should cause three lines to appear in your post. The first line is three back-ticks. The second line is “type or paste code here”. The third line is three back-ticks. Put your code between the lines of back-ticks.
you dont need a separate command to change into C:\Data on the local side, get takes it as the second argument, so get RemoteFile.txt C:\Data\ should drop it there. cd is only for the remote folder, and lcd would be the local equivalent if you wanted to set the working folder first.