Skip to content

Instantly share code, notes, and snippets.

@nakaji
Created August 22, 2012 00:21
Show Gist options
  • Save nakaji/3420755 to your computer and use it in GitHub Desktop.
Save nakaji/3420755 to your computer and use it in GitHub Desktop.
SSH2で接続するTeraTermマクロ
; SSH2で接続するTeraTermマクロ
;
; 1:IPアドレス(ホスト名)
; 2:ユーザ
; 3:パスワード
; 引数チェック
if paramcnt<4 then
messagebox "引数が不足しています"#13#10" 1:IPアドレス(ホスト名)"#13#10" 2:ユーザ"#13#10" 3:パスワード" "エラー"
end
endif
; ログファイル名に作業概要を付与するための入力
inputbox '作業概要を入力' '作業概要'
comment=inputstr
host=param2
user=param3
password=param4
; 接続文字列の作成
sprintf2 connString "%s /ssh /2 /auth=password /user=%s /passwd=%s" host user password
; 接続
connect connString
; ログ出力
logdir="log\"
getdate date "%Y%m%d-%H%M%S"
sprintf2 logfile "%s\%s_%s_%s.log" logdir host date comment
; logopen <filename> <binary flag> <append flag> [<plain text flag> [<timestamp flag> [<hide dialog flag>]]]
logopen logfile 0 1 0 0 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment