<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Creating a Custom URL Protocol for SSH</title>
	<link>http://www.nilpo.com/2007/08/windows-xp/creating-a-custom-url-protocol-for-ssh/</link>
	<description>Ask the Windows Guru!</description>
	<pubDate>Tue, 06 Jan 2009 23:14:00 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: LePiaf</title>
		<link>http://www.nilpo.com/2007/08/windows-xp/creating-a-custom-url-protocol-for-ssh/#comment-15022</link>
		<dc:creator>LePiaf</dc:creator>
		<pubDate>Tue, 28 Oct 2008 07:24:30 +0000</pubDate>
		<guid>http://www.nilpo.com/2007/08/windows-xp/creating-a-custom-url-protocol-for-ssh/#comment-15022</guid>
		<description>Thank you for your article. It's very good. I search very long time how to create my own protocol. I customise your script for my usage. 

LePiaf</description>
		<content:encoded><![CDATA[<p>Thank you for your article. It&#8217;s very good. I search very long time how to create my own protocol. I customise your script for my usage. </p>
<p>LePiaf</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nilpo</title>
		<link>http://www.nilpo.com/2007/08/windows-xp/creating-a-custom-url-protocol-for-ssh/#comment-1597</link>
		<dc:creator>Nilpo</dc:creator>
		<pubDate>Tue, 26 Feb 2008 01:21:40 +0000</pubDate>
		<guid>http://www.nilpo.com/2007/08/windows-xp/creating-a-custom-url-protocol-for-ssh/#comment-1597</guid>
		<description>Looks good, Tim.  Thanks for the addition!</description>
		<content:encoded><![CDATA[<p>Looks good, Tim.  Thanks for the addition!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim Koopman</title>
		<link>http://www.nilpo.com/2007/08/windows-xp/creating-a-custom-url-protocol-for-ssh/#comment-1579</link>
		<dc:creator>Tim Koopman</dc:creator>
		<pubDate>Mon, 25 Feb 2008 07:09:25 +0000</pubDate>
		<guid>http://www.nilpo.com/2007/08/windows-xp/creating-a-custom-url-protocol-for-ssh/#comment-1579</guid>
		<description>Hi,

I made a small mod to your ssh.vbs script to enable it to accept custom ports. Did it quick and dirty could be done a bit better but works.

Tim

' Region Description
'
' Name: ssh.vbs
' Author: Robert Dunham (Nilpo)
' Website: http://www.nilpo.com
' Description: This script is for use with a custom SSH protocol for Putty.
' 
' EndRegion

strSSH = "C:\ssh\putty.exe"
strPort = "22"

Select Case WScript.Arguments.Count
	Case 0
		WScript.Echo "No hostname provided.  Aborting SSH operation."
		WScript.Quit
	Case Else
		Set colArgs = WScript.Arguments
		For i = 0 To WScript.Arguments.Count - 1
			strHost = " " &#38; WScript.Arguments.Item(i)
		Next
End Select

Set WshShell = CreateObject("WScript.Shell")
strHost = CleanHostname(strHost)
WshShell.Run """" &#38; strSSH &#38; """ -P " &#38; strPort &#38; " """ &#38; strHost &#38; """"
WScript.Quit

Function CleanHostname(strHost)
	strHost = Trim(strHost)
	'Remove protocol if it was passed
	If InStr(strHost, "ssh://") = 1 Then
		strHost = Right(strHost, Len(strHost) - 6)
	End If
	'Remove trailing slash if present
	If InStrRev(strHost, "/") = Len(strHost) Then
		strHost = Left(strHost, Len(strHost) - 1)
	End If
	If InStrRev(strHost, ":") &#62; 0 Then
		strPort = right(strHost, Len(strHost) - InStrRev(strHost, ":"))
		strHost = Left(strHost, InStrRev(strHost, ":") - 1)
	End If
	'Return cleaned hostname
	CleanHostname = strHost
End Function</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I made a small mod to your ssh.vbs script to enable it to accept custom ports. Did it quick and dirty could be done a bit better but works.</p>
<p>Tim</p>
<p>&#8216; Region Description<br />
&#8216;<br />
&#8216; Name: ssh.vbs<br />
&#8216; Author: Robert Dunham (Nilpo)<br />
&#8216; Website: <a href="http://www.nilpo.com" rel="nofollow">http://www.nilpo.com</a><br />
&#8216; Description: This script is for use with a custom SSH protocol for Putty.<br />
&#8216;<br />
&#8216; EndRegion</p>
<p>strSSH = &#8220;C:\ssh\putty.exe&#8221;<br />
strPort = &#8220;22&#8243;</p>
<p>Select Case WScript.Arguments.Count<br />
	Case 0<br />
		WScript.Echo &#8220;No hostname provided.  Aborting SSH operation.&#8221;<br />
		WScript.Quit<br />
	Case Else<br />
		Set colArgs = WScript.Arguments<br />
		For i = 0 To WScript.Arguments.Count - 1<br />
			strHost = &#8221; &#8221; &amp; WScript.Arguments.Item(i)<br />
		Next<br />
End Select</p>
<p>Set WshShell = CreateObject(&#8221;WScript.Shell&#8221;)<br />
strHost = CleanHostname(strHost)<br />
WshShell.Run &#8220;&#8221;"&#8221; &amp; strSSH &amp; &#8220;&#8221;" -P &#8221; &amp; strPort &amp; &#8221; &#8220;&#8221;" &amp; strHost &amp; &#8220;&#8221;"&#8221;<br />
WScript.Quit</p>
<p>Function CleanHostname(strHost)<br />
	strHost = Trim(strHost)<br />
	&#8216;Remove protocol if it was passed<br />
	If InStr(strHost, &#8220;ssh://&#8221;) = 1 Then<br />
		strHost = Right(strHost, Len(strHost) - 6)<br />
	End If<br />
	&#8216;Remove trailing slash if present<br />
	If InStrRev(strHost, &#8220;/&#8221;) = Len(strHost) Then<br />
		strHost = Left(strHost, Len(strHost) - 1)<br />
	End If<br />
	If InStrRev(strHost, &#8220;:&#8221;) &gt; 0 Then<br />
		strPort = right(strHost, Len(strHost) - InStrRev(strHost, &#8220;:&#8221;))<br />
		strHost = Left(strHost, InStrRev(strHost, &#8220;:&#8221;) - 1)<br />
	End If<br />
	&#8216;Return cleaned hostname<br />
	CleanHostname = strHost<br />
End Function</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nilpo</title>
		<link>http://www.nilpo.com/2007/08/windows-xp/creating-a-custom-url-protocol-for-ssh/#comment-17</link>
		<dc:creator>Nilpo</dc:creator>
		<pubDate>Fri, 10 Aug 2007 16:55:32 +0000</pubDate>
		<guid>http://www.nilpo.com/2007/08/windows-xp/creating-a-custom-url-protocol-for-ssh/#comment-17</guid>
		<description>Thank you so much, Kyle.  It was a pleasure.  I'm glad I could help!</description>
		<content:encoded><![CDATA[<p>Thank you so much, Kyle.  It was a pleasure.  I&#8217;m glad I could help!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kavernon</title>
		<link>http://www.nilpo.com/2007/08/windows-xp/creating-a-custom-url-protocol-for-ssh/#comment-16</link>
		<dc:creator>kavernon</dc:creator>
		<pubDate>Fri, 10 Aug 2007 15:36:13 +0000</pubDate>
		<guid>http://www.nilpo.com/2007/08/windows-xp/creating-a-custom-url-protocol-for-ssh/#comment-16</guid>
		<description>Robert,

Thanks so much for your help.  The insight you gave into the nature of the issue along with the suggestions and ultimately a packaged software solution was exactly what I was looking for.  Keep up the great work!

Kyle</description>
		<content:encoded><![CDATA[<p>Robert,</p>
<p>Thanks so much for your help.  The insight you gave into the nature of the issue along with the suggestions and ultimately a packaged software solution was exactly what I was looking for.  Keep up the great work!</p>
<p>Kyle</p>
]]></content:encoded>
	</item>
</channel>
</rss>
