SHARE
TWEET

URL Extender

sweenig Feb 12th, 2015 (edited) 1,580 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2. goto:start
  3. urlextend - Compiled by Stuart Weenig (http://stuart.weenig.com)
  4. Original code written by James Clements - james@jjclements.co.uk http://www.jjclements.co.uk/2010/03/13/ssh-scp-hyperlink/
  5. :start
  6. :ssh
  7. echo Building ssh:// protocol handler...
  8. echo var server=(WScript.Arguments(0))>C:\Windows\hyperlink-ssh.js
  9. echo var prefix='ssh://'>>C:\Windows\hyperlink-ssh.js
  10. echo var app='C:\\Windows\\SysWOW64\\putty.exe'>>C:\Windows\hyperlink-ssh.js
  11. echo server=server.replace(prefix, '')>>C:\Windows\hyperlink-ssh.js
  12. echo server=server.replace('/', '')>>C:\Windows\hyperlink-ssh.js
  13. echo var shell = new ActiveXObject("WScript.Shell")>>C:\Windows\hyperlink-ssh.js
  14. echo shell.Exec(app + " " + server)>>C:\Windows\hyperlink-ssh.js
  15. echo Installing putty...
  16. move /Y putty.exe C:\WINDOWS\SysWOW64
  17. echo Registering SSH URL association...
  18. reg add "HKCR\ssh" /f /v "" /t REG_SZ /d "URL:SSH Connection" > nul
  19. reg add "HKCR\ssh" /f /v "URL Protocol" /t REG_SZ /d "" > nul
  20. reg add "HKCR\ssh\DefaultIcon" /f /v "" /t REG_SZ /d "C:\WINDOWS\SysWOW64\putty.exe" > nul
  21. reg add "HKCR\ssh\shell\open\command" /f /v "" /t REG_SZ /d "wscript.exe C:\WINDOWS\hyperlink-ssh.js %%1" > nul
  22. :scp
  23. echo Building scp:// protocol handler...
  24. echo var server=(WScript.Arguments(0))>C:\Windows\hyperlink-scp.js
  25. echo var prefix='scp://'>>C:\Windows\hyperlink-scp.js
  26. echo var app='C:\\WINDOWS\\SysWOW64\\winscp.exe'>>C:\Windows\hyperlink-scp.js
  27. echo server=server.replace(prefix, '')>>C:\Windows\hyperlink-scp.js
  28. echo server=server.replace('/', '')>>C:\Windows\hyperlink-scp.js
  29. echo var shell = new ActiveXObject("WScript.Shell")>>C:\Windows\hyperlink-scp.js
  30. echo shell.Exec(app + " " + server)>>C:\Windows\hyperlink-scp.js
  31. echo Installing WinSCP...
  32. move /Y WinSCP.exe C:\WINDOWS\SysWOW64\winscp.exe
  33. echo Registering SCP URL association...
  34. reg add "HKCR\scp" /f /v "" /t REG_SZ /d "URL:SCP Connection" > nul
  35. reg add "HKCR\scp" /f /v "URL Protocol" /t REG_SZ /d "" > nul
  36. reg add "HKCR\scp\DefaultIcon" /f /v "" /t REG_SZ /d "C:\WINDOWS\SysWOW64\winscp.exe" > nul
  37. reg add "HKCR\scp\shell\open\command" /f /v "" /t REG_SZ /d "wscript.exe C:\WINDOWS\hyperlink-scp.js %%1" > nul
  38. :rdp
  39. echo Building rdp:// protocol handler...
  40. echo var server=(WScript.Arguments(0))>C:\Windows\hyperlink-rdp.js
  41. echo var prefix='rdp://'>>C:\Windows\hyperlink-rdp.js
  42. echo var app='C:\\WINDOWS\\system32\\mstsc.exe'>>C:\Windows\hyperlink-rdp.js
  43. echo server=server.replace(prefix, '')>>C:\Windows\hyperlink-rdp.js
  44. echo server=server.replace('/', '')>>C:\Windows\hyperlink-rdp.js
  45. echo var shell = new ActiveXObject("WScript.Shell")>>C:\Windows\hyperlink-rdp.js
  46. echo shell.Exec(app + " /v:" + server)>>C:\Windows\hyperlink-rdp.js
  47. echo Registering RDP URL association...
  48. reg add "HKCR\rdp" /f /v "" /t REG_SZ /d "URL:Remote Desktop Connection" > nul
  49. reg add "HKCR\rdp" /f /v "URL Protocol" /t REG_SZ /d "" > nul
  50. reg add "HKCR\rdp\DefaultIcon" /f /v "" /t REG_SZ /d "C:\WINDOWS\System32\mstsc.exe" > nul
  51. reg add "HKCR\rdp\shell\open\command" /f /v "" /t REG_SZ /d "wscript.exe C:\WINDOWS\hyperlink-rdp.js %%1" > nul
  52. :finish
  53. pause
RAW Paste Data
Top