0
我從powershell腳本中調用psftp.exe,並正確下載指定的文件並正常運行,並將錯誤(如下所示)引發到命令行輸出,只要我可以說,整個過程沒有實質性的影響。與Powershell運行psftp時出錯
.\psftp.exe : Looking up host "hostname.com"
At line:2 char:1
+ .\psftp.exe 'hostname.com' -l 'username' -pw 'password ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Looking up host "hostname.com":String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Connecting to <HostIP> port <PortNo.>
Server version: <Version>
Using SSH protocol <Version>
We claim version: <Version>
Host key fingerprint is:
<key>
Using username "<username>".
Attempting keyboard-interactive authentication
Access granted
Opening session as main channel
Opened main channel
Started a shell/command
Sent EOF message
Server sent command exit status 0
Disconnected: All channels closed
有誰知道這是什麼錯誤提示。當然,如果任何通過的憑據都是錯誤的,會話將無法正確連接並下載文件?
的腳本如下的完整性:
.\psftp.exe 'hostname.com' -l 'username' -pw 'Pass' -P 'portNo' -v -b 'GetFiles.txt' # -be -bc
基於標記爲解決方案的反應,我已經修改爲 (.\psftp.exe 'hostname.com' -l 'username' -pw 'Pass' -P 'portNo' -v -b 'GetFiles.txt') 2> $null
我在這個例子中使用了powershell ISE。儘管不完全確定原因,但在結尾添加2> $ null似乎已經完成了這個訣竅......猜猜看是否有邊閱讀。非常感謝。 – ricky89