hosts - Open the file with admin privilege in ruby -



hosts - Open the file with admin privilege in ruby -

on windows machine(with windows 7 running, x86-64) possible open 'etc/hosts' file in system32/drivers/etc, modify , save ruby?

i "not opened writing(ioerror)" error code simple file = file.open("c:/windows/system32/drivers/etc/hosts") file << "new line"

instead of trying acquire privileges code ( maybe won't portable across different windows os'es ), this:

open command prompt administrator run script there

by doing this, programs you're executing have administrative privileges well.

edit: problem:

file = file.open("c:/windows/system32/drivers/etc/hosts","w") file << "new line"

you have open file in write mode.

ruby hosts

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -