How can I create a new process with another User Account on Windows?

后端 未结 5 1280
盖世英雄少女心
盖世英雄少女心 2021-01-11 16:11

Is it possible to create a new process on windows with a different user account? I know there are a context menu \"Run as\" but I want do it from Java. I have the username a

5条回答
  •  广开言路
    2021-01-11 16:24

    RUNAS has the "/savecred" switch that let you enter the credential only the first time. One potential problem is that when /SaveCred saves the credentials it saves it for whenever RUNAS invokes that user account. This can be a huge security risk so be careful using it!

    Example at http://www.rgagnon.com/javadetails/java-0014.html (at the end)

提交回复
热议问题