Advertisement
Guest User

Untitled

a guest
Sep 28th, 2015
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. @echo off
  2. :menu
  3. echo RDP:// HyperLink - James Clements - james@jjclements.co.uk
  4. echo ----------------------------------------------------------
  5. echo.
  6. echo.
  7. echo 1. Install RDP Association
  8. echo 2. Uninstall RDP Association
  9. echo 3. Quit
  10. echo.
  11. set choice=
  12. set /p choice=[1,2,3]?
  13. echo.
  14. if not '%choice%'=='' set choice=%choice:~0,1%
  15. if '%choice%'=='1' goto install
  16. if '%choice%'=='2' goto uninstall
  17. if '%choice%'=='3' goto quit
  18. echo.
  19. echo.
  20. echo "%choice%" is not a valid option - please try again
  21. echo.
  22. pause
  23. cls
  24. goto MENU
  25.  
  26. :quit
  27. cls
  28. exit
  29.  
  30. :uninstall
  31. if not exist "C:\Windows\hyperlink-rdp.js" (
  32. cls
  33. echo RDP:// HyperLink - James Clements - james@jjclements.co.uk
  34. echo ----------------------------------------------------------
  35. echo.
  36. echo.
  37. echo RDP:// HyperLink not installed - nothing to remove
  38. echo.
  39. pause
  40. exit)
  41.  
  42. del "C:\Windows\hyperlink-rdp.js" /f
  43. reg delete "HKCR\rdp" /f
  44.  
  45. cls
  46. echo RDP:// HyperLink - James Clements - james@jjclements.co.uk
  47. echo ----------------------------------------------------------
  48. echo.
  49. echo.
  50. echo RDP:// HyperLink uninstalled successfully
  51. echo.
  52. pause
  53. exit
  54.  
  55. :install
  56. if exist "C:\Windows\hyperlink-rdp.js" (
  57. cls
  58. echo RDP:// HyperLink - James Clements - james@jjclements.co.uk
  59. echo ----------------------------------------------------------
  60. echo.
  61. echo.
  62. echo RDP:// HyperLink already installed - nothing to install
  63. echo.
  64. pause
  65. exit)
  66.  
  67. echo var server=(WScript.Arguments(0))>>C:\Windows\hyperlink-rdp.js
  68. echo var prefix='rdp://'>>C:\Windows\hyperlink-rdp.js
  69. echo var app='C:\\WINDOWS\\system32\\mstsc.exe'>>C:\Windows\hyperlink-rdp.js
  70. echo server=server.replace(prefix, '')>>C:\Windows\hyperlink-rdp.js
  71. echo server=server.replace('/', '')>>C:\Windows\hyperlink-rdp.js
  72. echo var shell = new ActiveXObject("WScript.Shell")>>C:\Windows\hyperlink-rdp.js
  73. echo shell.Exec(app + " /v:" + server)>>C:\Windows\hyperlink-rdp.js
  74.  
  75. reg add "HKCR\rdp" /f /v "" /t REG_SZ /d "URL:Remote Desktop Connection"
  76. reg add "HKCR\rdp" /f /v "URL Protocol" /t REG_SZ /d ""
  77. reg add "HKCR\rdp\DefaultIcon" /f /v "" /t REG_SZ /d "C:\WINDOWS\System32\mstsc.exe"
  78. reg add "HKCR\rdp\shell\open\command" /f /v "" /t REG_SZ /d "wscript.exe C:\WINDOWS\hyperlink-rdp.js %%1"
  79.  
  80. cls
  81. echo RDP:// HyperLink - James Clements - james@jjclements.co.uk
  82. echo ----------------------------------------------------------
  83. echo.
  84. echo.
  85. echo RDP:// HyperLink installed successfully
  86. echo.
  87. pause
  88. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement