HTML 외부 프로그램 실행
HTML 태그
$("#ifameRun").remove();
var iframe = $("<iframe id=\"ifameRun\" />").attr("src" ,"AutoRun://")
$(document).find("body").append(iframe);
Regedit
JAVA APP
package appRun;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StringWriter;
import java.net.InetSocketAddress;
import javax.net.ssl.SSLParameters;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.swing.JFrame;
import com.sun.net.httpserver.HttpsConfigurator;
import com.sun.net.httpserver.HttpsParameters;
public class appRun extends JFrame {
private static appRun app = null;
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
String paramStr = "";
for(int i=0; i <args.length; i++){
paramStr +=" " + args[i];
}
app = new appRun();
app.startGui(paramStr);
}
private void startGui(String paramStr2)throws Exception{
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Runtime rt = Runtime.getRuntime();
Process process;
StringWriter sw = null;
try {
process = Runtime.getRuntime().exec("reg query HKCU\\SOFTWARE\\Classes\\AutoRun\\shell\\open\\command /v path");
BufferedInputStream in = new BufferedInputStream(process.getInputStream());
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream(),"EUC-KR"));
process.waitFor();
sw = new StringWriter();
int c;
while ((c = reader.read()) != -1){
sw.write(c);
}
System.out.println("sw " + sw);
String localPath = "";
if("".equals(sw)){
localPath = "C:\\RIFCViewer\\EngSoft.BIM.GUI.exe";
}else{
if(sw.toString().indexOf("D:") > -1){
localPath = sw.toString().substring(sw.toString().indexOf("D:") , sw.toString().indexOf("exe")+3);
}else{
if(sw.toString().indexOf("C:") > -1){
localPath = sw.toString().substring(sw.toString().indexOf("C:") , sw.toString().indexOf("exe")+3);
}else{
localPath = "C:\\RIFCViewer\\EngSoft.BIM.GUI.exe";
}
}
}
Runtime.getRuntime().exec("reg delete HKCU\\SOFTWARE\\Classes\\AutoRun /f");
Runtime.getRuntime().exec("reg add HKCU\\SOFTWARE\\Classes\\AutoRun /v \"url protocol\" /t REG_SZ /f");
Runtime.getRuntime().exec("reg add HKCU\\SOFTWARE\\Classes\\AutoRun\\shell\\open\\command /t REG_SZ /d \""+localPath+" "+paramStr2+"\" /f");
// Runtime.getRuntime().exec("reg add HKCU\\SOFTWARE\\Classes\\AutoRun\\shell\\open\\command -v path /t REG_SZ /d \""+localPath+" "+paramStr2+"\" /f");
String command = "START autoRun://";
ProcessBuilder pb = new ProcessBuilder("cmd.exe", "/c", command );
process = pb.start();
}finally{
// final appGui client = new appGui();
}
}
}