如何在完全管理员模式下 运行 Shell 函数(LotusScript 语言)
How to Run Shell function (LotusScript Language) in Full Administrator
我需要在完全管理器中使用 Shell 功能(LotusScript 语言)处理 PGP 命令行代码。我使用 CMD 行手动尝试了 pgp 命令,我已经确认问题是管理员权限。那么如何在管理员模式下触发Shell函数到运行呢?
Fixed the issue by modifying the Java Policy and was able to run the Shell command using JAVA agent.
import lotus.domino.*;
import java.util.*;
import java.io.*;
public class PGPCodeBuilderEngine {
/**
* Creates Encoded PGP file from the specified Input file
*/
public void EncodeFile(String inputFolder,
String inputName, String outputFolder,
String outputName, String passName)
{
try{
String[] cmd = new String[3];
cmd[0] = "cmd.exe" ;
cmd[1] = "/c" ;
cmd[2] = "pgp --encrypt " + inputFolder + "/" +
inputName + " --recipient " + passName +
" --input-cleanup wipe --output " + outputFolder + "/" +
outputName + " --overwrite wipe --status-file " +
outputFolder + "\status.log -v";
// must be run with unrestricted access
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec(cmd);
cmd = null;
rt = null;
proc = null;
} catch(Exception e) {
e.printStackTrace();
}finally{
System.gc();
}
}
}
我需要在完全管理器中使用 Shell 功能(LotusScript 语言)处理 PGP 命令行代码。我使用 CMD 行手动尝试了 pgp 命令,我已经确认问题是管理员权限。那么如何在管理员模式下触发Shell函数到运行呢?
Fixed the issue by modifying the Java Policy and was able to run the Shell command using JAVA agent.
import lotus.domino.*;
import java.util.*;
import java.io.*;
public class PGPCodeBuilderEngine {
/**
* Creates Encoded PGP file from the specified Input file
*/
public void EncodeFile(String inputFolder,
String inputName, String outputFolder,
String outputName, String passName)
{
try{
String[] cmd = new String[3];
cmd[0] = "cmd.exe" ;
cmd[1] = "/c" ;
cmd[2] = "pgp --encrypt " + inputFolder + "/" +
inputName + " --recipient " + passName +
" --input-cleanup wipe --output " + outputFolder + "/" +
outputName + " --overwrite wipe --status-file " +
outputFolder + "\status.log -v";
// must be run with unrestricted access
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec(cmd);
cmd = null;
rt = null;
proc = null;
} catch(Exception e) {
e.printStackTrace();
}finally{
System.gc();
}
}
}