Powershell Putty 连接和自动化任务

Gar*_*ley 2 powershell putty batch-file

我想使用 PowerShell 连接到 PuTTY“保存的会话”,然后指定包含一些批处理命令的文件。使用 CMD 这看起来像

d:\putty\psftp 'Saved Session Name' -b d:\location.txt.
Run Code Online (Sandbox Code Playgroud)

我认为PS等效应该是这样的

Start-Process d:\putty\psftp.exe 'Saved Session Name' 
(and then a call to pass a 'get' script) i.e. cd Outgoing get <date>.txt 
Run Code Online (Sandbox Code Playgroud)

但是,我收到以下错误:

a positional parameter cannot be found that accepts the argument
Run Code Online (Sandbox Code Playgroud)

如何使用 PowerShell 完成此任务?

Enz*_*ojz 5

所有你需要的是plink

plink 'Saved Session Name'
Run Code Online (Sandbox Code Playgroud)