Xshell for JumpServer

JumpServer自动打开Xshell

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

You will need to install an extension such as Tampermonkey to install this script.

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

Advertisement:

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

Advertisement:

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
作者
gdisk
1日のインストール数
0
累計インストール数
1
評価
0 0 0
バージョン
1.0.0
作成日
2026/06/25
更新日
2026/06/25
大きさ
5.89KB
ライセンス
MIT
対象サイト
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\xshell]
@="URL:xshell Protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\xshell\shell]
[HKEY_CLASSES_ROOT\xshell\shell\open]
[HKEY_CLASSES_ROOT\xshell\shell\open\command]
@="\"wscript.exe\" \"D:\\Softwares\\Scripts\\xshell\\open_xshell.vbs\" \"%1\""
If WScript.Arguments.Count = 0 Then WScript.Quit

Dim url
url = WScript.Arguments(0)

' ===== 新增功能:记录URL到文件 =====
Dim scriptPath, logFile, fso, fileStream, currentTime
' 获取当前脚本的完整路径
scriptPath = WScript.ScriptFullName
' 获取脚本所在的目录
scriptPath = Left(scriptPath, InStrRev(scriptPath, "\") - 1)
' 日志文件路径(在脚本同级目录下)
logFile = scriptPath & "\access.log"
' 获取当前时间
currentTime = Now()
' 创建文件系统对象
Set fso = CreateObject("Scripting.FileSystemObject")
' 以追加方式打开文件(如果文件不存在则创建)
Set fileStream = fso.OpenTextFile(logFile, 8, True)
' 写入时间戳和URL
fileStream.WriteLine "[" & currentTime & "] " & url
' 关闭文件
fileStream.Close
' 释放对象
Set fileStream = Nothing
Set fso = Nothing
' ===== 记录功能结束 =====

' 处理URL格式转换:
' 支持格式1: xshell://ssh:admin:pwd@ip:port -> ssh://admin:pwd@ip:port
' 支持格式2: xshell://admin:pwd@ip:port -> ssh://admin:pwd@ip:port
If InStr(LCase(url), "xshell://ssh://") = 1 Then
    url = "ssh://" & Mid(url, 16)
ElseIf InStr(LCase(url), "xshell://ssh//") = 1 Then
    url = "ssh://" & Mid(url, 15)
ElseIf InStr(LCase(url), "xshell://ssh:") = 1 Then
    url = "ssh://" & Mid(url, 14)
ElseIf InStr(LCase(url), "xshell://") = 1 Then
    url = "ssh://" & Mid(url, 10)
End If

' 请根据你的实际安装路径修改 Xshell.exe 的路径!
' 以下是 Xshell 7 的默认路径示例
Dim xshellPath
xshellPath = "C:\Program Files (x86)\NetSarang\Xshell 8\Xshell.exe"

Set ws = CreateObject("WScript.Shell")
' 0 表示隐藏窗口运行,避免黑框一闪而过
ws.Run """" & xshellPath & """ -url " & url, 0, False