【问题标题】:System call in JRuby as an administrator以管理员身份在 JRuby 中进行系统调用
【发布时间】:2014-09-16 17:48:23
【问题描述】:

我正在向命令提示符(在 JRuby 脚本中)发送一个命令:

system("cd .. && REG ADD \"HKLM\\SOFTWARE\\etc\\foo\\foo\" /f /v Data /t REG_SZ /d 3")

但是,我需要管理权限才能执行该命令。如果我对我的机器有管理权限,我如何通过这个系统调用告诉命令提示符?

【问题讨论】:

    标签: ruby windows command-line jruby


    【解决方案1】:

    您是否尝试过使用 runas 执行“sudo”,例如runas /noprofile /user:Administrator

    system("runas /noprofile /user:Administrator REG ADD \"HKLM\\SOFTWARE\\etc\\foo\\foo\" /f /v Data /t REG_SZ /d 3")
    

    更多信息请查看https://superuser.com/questions/42537/is-there-any-sudo-command-for-windows

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-09-18
      • 1970-01-01
      • 2013-07-10
      • 2011-08-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多