![SSH経由で接続するときにPuttyコマンドを自動的に実行するには? [閉鎖]](https://linux33.com/image/8389/SSH%E7%B5%8C%E7%94%B1%E3%81%A7%E6%8E%A5%E7%B6%9A%E3%81%99%E3%82%8B%E3%81%A8%E3%81%8D%E3%81%ABPutty%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89%E3%82%92%E8%87%AA%E5%8B%95%E7%9A%84%E3%81%AB%E5%AE%9F%E8%A1%8C%E3%81%99%E3%82%8B%E3%81%AB%E3%81%AF%EF%BC%9F%20%5B%E9%96%89%E9%8E%96%5D.png)
そこには2つのファイルがあります。 SSHポート接続でcmds.txt cmdを実行したいと思います。 Puttyを使用してtxtファイルを実行する方法
これがsv.bat(バッチファイル)であると仮定すると
バッチファイル内にcmdsを含むtxtファイルがあります。
start C:\USERS\putty\putty.exe -ssh 10.15.12.12 -m C:\USERS\cmds.txt
cmds.txt
login
password
答え1
txtファイルを作成したら、次のものを作成する必要があります。バットファイルを保存するか、CMDプロンプトで次のように入力します。
ssh.cmd
@echo on
[何が起こったのか見て]- [PuTTYのインストールに進みます。 ]
cd C:\Program Files\Putty
- スタート
putty.exe -ssh [domain name] -l [username] -pw [password] -m [the directory of the .txt file you created which contains the codes you want to be executed]
-m
オプションが機能しない場合は、代わりに(PuTTYバックエンドのコマンドラインインターフェイス)を使用する必要がありますplink.exe
。putty.exe
-m file read remote command(s) from file
あなたから始めますPuTTYダウンロードページ