How to supply password to runas command when executing it from java

前端 未结 3 670
无人共我
无人共我 2021-02-13 15:03

I have to run a batch files from a java program which need administrative privilege. I am using the below command

runtime.getruntime().exec(\"runas /user:Admin \         


        
3条回答
  •  一生所求
    2021-02-13 15:24

    You can't pipe a password into runas, as it requests the password from the terminal, not from stdin. There's no equivalent of "sudo -s".

提交回复
热议问题