Sudo for Vista
The following ruby script when given any executable file path as the argument runs it in administrative mode.
1: require 'Win32API'
2:
3: def shell_execute(process_name)
4: process = ''
5: process.replace(process_name)
6: se = Win32API.new("shell32", "ShellExecute", ['P','P','P','P','P','I'], 'I')
7: se.Call(nil,"runas",process,nil,nil,5)
8: end
9:
10: shell_execute(ARGV[0])
In Vista you can do the same by right clicking on the file and selecting “Run as Administrator” but this script allows you to run a process in admin mode using the command line.
The ShellExecute function resides in the shell32.dll and is documented here.
By just giving “runas” as the second parameter to the function the process is executed in the administrative mode.



[...] sudo, vista, vista, security, windows by techblogger on April 2nd, 2008 In one of my earlier blog post I shared source code for a simple utility that I had made. It could be used to launch elevated [...]
New and Improved Sudo for Vista (now remembers credentials) « Blogging on technology
April 2, 2008