Copy link to clipboard
Copied
Hello everyone,my Os is Windows 7 EntrepriseI have written this A.E. scriptvar myFile= new File("C:/myBatch.bat");
myFile.execute();When I double clic in my file browser on myBatch.bat, it opens cmd.exe and the batch is correctly executedBUT, if I launch it from an After Effects script as written above, the command window opens and closes at once and nothing happens.The script above works for any kind of applications (.doc, .xls,..) but not with .bat. WHY?Many thanks,
Copy link to clipboard
Copied
Hi jobo3553,
Maybe you can try to run the batch script like this,
runBatchScript = function(BAT_PATH) {
cmd = "cmd.exe /c \"\"" + BAT_PATH + "\" \"";
return system.callSystem(cmd);
}
runBatchScript("D:/Desktop/test.bat");
Copy link to clipboard
Copied
Hi Zhiqing_Li,
Many thanks for your contribution. Unfortunately, it does not work on my system. Does it on yours?
Copy link to clipboard
Copied
Yes, it works on my computer. The idea is running the bat file from cmd
Copy link to clipboard
Copied
Hi Zhiqing,
GOOD NEWS. It works now. Even with a slightly simpler script as the one below (on Windows).
runBatchScript = function(BAT_PATH) {
cmd = "cmd.exe /c " + BAT_PATH ;
return system.callSystem(cmd);
}
runBatchScript("D:/Desktop/test.bat");
The reason of the issue I had before was that in my batch I was calling configuration text files or commands using relative path names. It only works when double-clicking on the batch file inside the file explorer but using After Effects scripting it is necessary to refer to command or files inside the batch using ABSOLUTE file path (c:\folder1\folder2\textFile.txt etc.)
Many thanks again for your precious help.
Copy link to clipboard
Copied
Congratulation
Copy link to clipboard
Copied
Hi jobo5533,
I have tried the same command suggested by you. But I get error saying that "Unable to access jar file filename.jar ".
my batch file content is
java -jar ./filename.jar ./
I have the filename.jar in the exact same path as the batch file. Do you have any idea?