我想创建一个按钮来从html页面启动putty会话 [英] i want to create a button to start putty session from html page

查看:72
本文介绍了我想创建一个按钮来从html页面启动putty会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

搜索了很多但是找不到它。

searched a lot but, couldn't find it.

推荐答案

所以默认情况下Putty没有任何与之关联的URI - 我在说使外部应用程序启动的部分..

So by default Putty doesn't have any URI's associated with it - I'm talking about the part that makes external applications launch..
ftp://
skype://
itunes:// 





所以你需要将协议添加到windows注册表(该按钮只能在你执行此操作的机器上运行)..



这是一个很好的教程,如何做到这一点:从浏览器启动PuTTY - 向Windows添加协议 [ ^ ]





简而言之,这就是你所做的:



1.在Windows的注册表中注册一个新协议(在我们的例子中,我们称之为ssh)。

2.创建一个可以接受的批处理文件字符串,例如ssh://google.com并按下它们并将它们传递给putty.exe

3.将注册表修改指向该批处理文件。



第1步 - .reg文件,保存为putty.reg,右键单击并选择合并



So you need to add the protocol to windows registry (the button will only work on the machine you do this on)..

Here's a great tutorial of how to do this: Launch PuTTY from Your Browser – Adding Procotols to Windows[^]


In short, this is what you do:

1. Register a new protocol (in our case, let’s call it "ssh") to Windows’s registry.
2. Create a batch file that can take in strings such as "ssh://google.com" and massage them and pass them on to putty.exe
3. Point the registry modification to that batch file.

Step 1 - the .reg file, save it as putty.reg, right click it and select merge

REGEDIT4
[HKEY_CLASSES_ROOT\ssh]
@="URL:ssh Protocol"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\ssh\shell]
[HKEY_CLASSES_ROOT\ssh\shell\open]
[HKEY_CLASSES_ROOT\ssh\shell\open\command]
@="\"C:\\putty_util.bat\" %1"



注意:更改putty_util.bat位置你去哪里制作.bat(批处理文件)



步骤2 - putty_util.bat文件,保存在您在.reg文件中指定的位置


Note: change the putty_util.bat location to where-ever you make your .bat (batch file)

Step 2 - the putty_util.bat file, save it in the location you specified in the .reg file

@echo off
set var=%1
set extract=%var:~6,-1%
"C:\Program Files\PuTTY\putty.exe" %extract%







尝试启动 ssh :// 从您的浏览器链接并查看putty是否启动




Try launch a ssh:// link from your browser and see if putty launches


这篇关于我想创建一个按钮来从html页面启动putty会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆