在VB中跟随脚本打开exe并解析参数是可以的。
File file = new File("D:\\Program Files\\Oracle\\program\\Record.txt");
if (file.length() <= 0) {
try {
FileReader fr = new FileReader(
"D:\\Program Files\\Oracle\\program\\inventory.txt");
BufferedReader br = new BufferedReader(fr);
String datas = "";
while ((datas = br.readLine()) != null) {
String[] d = datas.split(",");
int a = Integer.parseInt(d[1]);
int b = Integer.parseInt(d[2]);
items.add(new list(d[0], a, b));
}
br.close();
fr.close();
} catch (IOException | NumberFormatException e) {
System.out.println("Error");
}
}
Iterator itemit = items.iterator();
try {
FileWriter fw = new FileWriter(
"D:\\Program Files\\Oracle\\program\\Record.txt");
BufferedWriter bw = new BufferedWriter(fw);
itemit = items.iterator();
while (itemit.hasNext()) {
list l = (list) itemit.next();
System.out.println(l.ingname + l.qty + l.ingid);
if (item1 == 1 && l.ingid == 100) {
l.qty = l.qty - item1qty;
}
if (item2 == 1 && l.ingid == 200) {
l.qty = l.qty - item2qty;
}
bw.write(l.ingname + ":" + l.qty + ":" + l.ingid);
bw.newLine();
}
bw.close();
fw.close();
} catch (IOException e) {
System.out.println("Error");
}
else{
try{
FileReader fr = new FileReader("D:\\Program Files\\Oracle\\program\\Record.txt");
BufferedReader br = new BufferedReader(fr);
String datas = "";
//System.out.println(file.length());
while((datas = br.readLine()) != null){
String[] d = datas.split(",");
int x = Integer.parseInt(d[1]);
items.add(new list(d[0],x));
}
br.close();
fr.close();
}catch(IOException | NumberFormatException e){
System.out.println("Error");
}
}
尝试使用批处理文件替换此文件,在该文件中我可以打开exe并解析参数。-NENTRY一旦运行,应在exe上打开一个窗口,但是在我的exe中不起作用。下面是我当前的脚本:它会打开exe文件,但不会打开新窗口(在VB脚本中有效)
strProgramName = "C:\Documents\Test\Imp\imp.exe"
strArgument = " -NENTRY"
Call Shell("""" & strProgramName & """ " & strArgument, vbNormalFocus)
我想念什么?