Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.61 KB | None | 0 0
  1. #!/usr/bin/ruby
  2.  
  3. # path settings
  4. local='/home/jan/';
  5. invm='Z:\\';
  6. username="Jan"
  7. machine="Windows XP"
  8.  
  9.  
  10. # get full path of file to open
  11. toopen = File.expand_path(ARGV[0])
  12. # check if its in the right path
  13. if toopen[0..local.length-1] != local
  14.   $stderr.puts "Error: #{toopen} is not in #{local}"
  15.   exit 1
  16. end
  17.  
  18. # assemble Windows path
  19. winpath = invm + toopen[local.length..toopen.length]
  20. winpath.gsub!("/","\\")
  21.  
  22. # now call it
  23.  
  24.  
  25. `VBoxManage guestcontrol execute \"#{machine}\" \"c:\\windows\\system32\\rundll32.exe\" --arguments \"dummy url.dll,FileProtocolHandler #{winpath} \" --username \"#{username}\"`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement