TeraTerm自动登录(Login)

79 篇文章 1 订阅
2 篇文章 0 订阅

目录

■目录结构

■bat

■ttl

■效果

■注意点

■更多

1.TeraTerm指定log方式

2.通过TTL设定,①指定TeraTerm窗口名称、②让Log中显示时间信息、③指定log名字

代码

       ①课题:不知为何 settile 没有效果

①指定TeraTerm窗口名称:效果

       ①课题解决:Accept window title change request 设置为 last

代码调试:当代码不正确时,会有提示 

③指定log名字:效果

②让Log中显示时间信息:效果

3.直接在TeraTerm的log设定中指定时间

3.效果

■参照


■目录结构

■bat

set password=yourPassword
set windowTitle='MyLinux'
"C:\Program Files (x86)\teraterm-4.98\ttpmacro.exe" "%~dp0ttl\autoLogin.ttl" %password%

■ttl

自动登陆后,执行一条ls -l 命令

password = param2

command = '192.168.131.128:22 /ssh /2  /auth=password /user=sxz001 /passwd='

strconcat command password

connect command 

if result <> 2 then
    messagebox 'Can not connected'
    end
endif

timeout = 10
wait '>' '$' '#'
if result = 0 then
    end
endif

command = "ls -l"
sendln command

wait '$'
sendln 'id'

■效果

■注意点

●平时执行 TeraTerm时,使用的执行文件

    "C:\Program Files (x86)\teraterm-4.98\ttermpro.exe"

●执行ttl时,使用的执行文件

    "C:\Program Files (x86)\teraterm-4.98\ttpmacro.exe" 

■更多

1.TeraTerm指定log方式

Teraterm的Log设定_sun0322的博客-CSDN博客_teraterm自动保存log

2.通过TTL设定,①指定TeraTerm窗口名称、②让Log中显示时间信息、③指定log名字

代码


password = param2

command = '192.168.131.128:22 /ssh /2  /auth=password /user=sxz001 /passwd='

strconcat command password
connect command

windowTitle='myLinux'
USERNAME='sxz'
settitle windowTitle

;; if result <> 2 then
;;    messagebox 'Can not connected'
;;     end
;; endif

gettime timestr "%Y%m%d-%H%M%S"
sprintf2 filename 'teraterm_%s_%s_%s.log' windowTitle USERNAME timestr
getdir logdir
strconcat logdir '\log'
changedir logdir

logopen filename 0 0 0 1 0 0 0 

timeout = 10
wait '>' '$' '#'
if result = 0 then
    end
endif

command = "ls -l"
sendln command

       ①课题:不知为何 settile 没有效果

===

需要之后 Reset Remote title

 才能看到下面的效果

①指定TeraTerm窗口名称:效果

 

       ①课题解决:Accept window title change request 设置为 last

 

代码调试:当代码不正确时,会有提示 

缺少上面第一行代码时。。。

===

===

③指定log名字:效果

 注意: 如果TeraTerm侧,已经设置log文件名格式,则ttl中设置的log格式无效

上面从第二个之后,是TeraTerm侧,设置log格式时显示的,log文件名

teraterm_%Y%m%d_%H%M%S_&h.log

②让Log中显示时间信息:效果

 ===

3.直接在TeraTerm的log设定中指定时间

3.效果

===

■参照

TeraTerm 自動ログインマクロ - forget for get

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值