0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

TeraTermのマクロで一定時間待つ

Last updated at Posted at 2023-01-17

概要

テストサーバーのデータベースサービス起動 or 停止 or 状態確認をTeraTermのマクロでやってる。
マクロ実行後に exit 入力する(TeraTerm閉じる)の面倒くさい。

コマンド実行結果を4~5秒くらい表示した後、TeraTermを終了してくれて構わない。

やり方

例えば pause 4 で4秒待つ。

サンプルttl
;ログイン情報。
USER_NAME = 'おなまえ'
USER_PASSWORD = 'おぱすわーど'
HOST = 'サーバー名またはサーバーIPあどれす'

;ログインコマンド生成。
login_command_ = HOST
strconcat login_command_ ' /ssh /auth=password /user='
strconcat login_command_ USER_NAME
strconcat login_command_ ' /passwd='
strconcat login_command_ USER_PASSWORD

;ログイン実行。
connect login_command_

;コマンドが入力できる状態まで待つ。
wait ""

;MariaDBのサービス起動状態取得。
sendln "sc query ""MariaDB"""

;表示しきる(次のコマンドが入力できる状態)まで待つ。
wait ""

;4秒待つ。
pause 4

;TeraTerm終了。
sendln "exit"

蛇足

TeraTermマクロについての基礎知識は下記。

参考サイトさん

バージョン

Windows 10 Pro 22H2 OSビルド 19045.2486
TeraTerm 4.106

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?