Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

barneyrubble15

solution - wonky Windows

I ended up quitting my PowerShell ISE session and restarting it fresh - script worked straight away when I ran it.

Windows at its finest ....

FWIW, I love the auto-generation of code available within WinSCP - makes life SO much simpler.
barneyrubble15

script works at command line, but not from within PowerShell script

I know this is a tired old topic, so I think I'm overlooking the incredibly obvious: I have a script that I can execute from a PowerShell window that works perfectly, however inserting the same code into a PowerShell script I get nothing, not even a log created.

My script is fairly simple :

& "C:\Program Files (x86)\WinSCP\WinSCP.com" `

        /log="ftplog.file.txt" /ini=nul `
      /loglevel=* `
        /command `
       "open ftp://user:password@999.999.999.999/" `
       "cd /home/directory" `
       "get monitor*.csv" `
   "rm monitor*.csv" `
       "exit"


I added the loglevel=* based on a FAQ topic, but I'm not seeing a log file.

As I said, from a command prompt, it works fine :

PS  & "C:\program Files (x86)\WinSCP\WinSCP.com" /log=ftplog.file.txt

ini=nul /loglevel=* /command "open ftp://user:password@999.999.999.999/"
connecting to 999.999.999.999 ...
connected
starting the session...
session started.
active session: [1] user@999.999.999.999
winscp> cd /home/directory
/home/directory
winscp> get monitor*.csv
monitor.file.csv      |          158 B |    2.4 KB/s | binary | 100%
winscp> exit


any help or insight would be appreciated.