Skip to content

Instantly share code, notes, and snippets.

Created January 23, 2011 18:15
DisAutoUpdate
DisAutoUpdate = function(set="off") {
if(Sys.getenv("OS")=="Windows_NT" ) {
if(set="off") { write("Net stop wuauserv",file="disauto.bat")} else {
write("Net start wuauserv",file="disauto.bat")}
prog <- paste(gsub("/","\\\\",getwd()),"\\","disauto.bat",sep="")
user <- paste(Sys.getenv("USERDOMAIN"), Sys.getenv("USERNAME"),sep="\\")
system(paste("CMD /k runas /user:\"", user ,"\" ",prog,sep=""),invisible=FALSE, show.output.on.console=FALSE)
} else {"Only needed on Windows"}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment