我想从java打开TestComplete,但是我不能这样做,因为缺乏特权。当我运行我的代码
public static void StartTC() {
try{
Process p = Runtime.getRuntime().exec(new String[] {"C:\\Program Files (x86)\\SmartBear\\TestComplete 11\\Bin\\TestComplete.exe"});
}
catch (IOException e) {
e.printStackTrace();
}
}该程序与CreateProcess error=740一起退出,并告诉我此操作需要更高的权限。我知道,我可以做一个.lnk与管理员奖励。在exe的开放属性上,但是可能有正确的方法来做到这一点。
发布于 2016-05-30 13:29:20
你需要禁用工具\\选项。支持在TestComplete中测试Windows应用程序选项。
有关这如何影响从外部应用程序(如您的示例中)使用TestComplete的信息,可以在测试Windows应用程序的要求帮助主题中找到。
发布于 2016-05-30 10:53:58
我认为您可以使用File类来设置权限。
File file = new File("File.c");
//but file permission are OS specific.
file.setExecutable(true);在linux中,它将起作用。
如果您使用的是windows,那么您可以运行"icacls“命令来授予该文件权限。
C:\>icacls "D:\test" /grant John:(OI)(CI)F /T此命令可用于在windows中授予权限。
According do MS documentation:
F = Full Control
CI = Container Inherit - This flag indicates that subordinate containers will inherit this ACE.
OI = Object Inherit - This flag indicates that subordinate files will inherit the ACE.
/T = Apply recursively to existing files and sub-folders. (OI and CI only apply to new files and sub-folders). Credit: comment by @AlexSpence.您可以使用Runtime.getRuntime().exec运行上面的命令(“这里有一些东西”);
I hope I helped you。
https://stackoverflow.com/questions/37523531
复制相似问题