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

Advertisement

barneyrubble15
Joined:
Posts:
2
Location:
US

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.

Reply with quote

Advertisement

barneyrubble15
Joined:
Posts:
2
Location:
US

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.

Reply with quote

Advertisement

You can post new topics in this forum