Execute bat file with cfexecute

Hello,
this is a newbie question but I'm stuck. I have a .bat that
runs fine through the command prompt but won't run with
<cfexecute>, it merely seems to read the .bat but not execute
it. The .bat reads:
java -classpath
".;C:\CFusionMX7\wwwroot\i-recall\javaClasses\GATE-3.1\bin\gate.jar"
AnnieAPI
When I run <cfexecute
name="C:\CFusionMX7\wwwroot\i-recall\javaClasses\GateClasspathRun.bat"
variable="myVar" timeout="100">
</cfexecute>
The output looks like this:
C:\CFusionMX7\runtime\bin>java -classpath
"C:\CFusionMX7\wwwroot\i-recall\javaClasses\GATE-3.1\bin\gate.jar"
AnnieAPI
It simply reads it and doesn't execute the java AnnieAPI
command. I didn't write this .bat file so maybe I need to add
something to make it run. Any help is appreciated.
-Kalen G

Same thing, just without the classpath in the output:
C:\CFusionMX7\runtime\bin>java AnnieAPI
Even if I remove the class path and simply leave java
AnnieAPI it doesn't run. It should get an error message without the
classpath or something but I don't And the page loads so quickly
it's obvious that Coldfusion is just reading the code and not
executing it.
Thanks

Similar Messages

  • Execute .bat file using cfexecute tag...

    Hello,
    I am trying to execute a batch file using cfexecute tag. This
    batch file needs 1 command line arguement, which I am passing using
    arguments
    Text attribute.
    When I run my batch file directly from command prompt, it
    works perfectly. but while using cfexecute, it doesn't seem to do
    anything.
    Note:- I am trying to encrypt a txt file using GPG algorithm
    in the batch file.
    Thanks in advance!
    Manju

    Hello,
    you have probally worked this out but if any of this helps :)
    I run an application that needs to print via dos command, so
    my cfm page makes a batch file writes some arguments to it then
    calls it with a cmd. the code is below if any of it helps im glad.
    (creates name for my bat file)
    <cfset BFname = '#namevariable#' & '.bat'>
    (sets up the text I need in the bat file)
    <cfset content = 'copy
    "c:\inetpub\wwwroot\mct\picklist.txt"
    \\MyPrintServer\ThePrinter'>
    (writes the bat file with the text in the content var)
    <cffile action="write"
    file="c:\inetpub\wwwroot\mct\#BFname#" output="#content#">
    (calls cmd to run the bat file)
    <cfexecute name="c:\windows\system32\cmd.exe"
    arguments="/c c:\inetpub\wwwroot\mct\#BFname#"
    outputfile="c:\inetpub\wwwroot\mct\log_output.txt"
    timeout="1"></cfexecute>
    Regards Guy

  • Problems running bat file with calls to java programs (.jar)

    I created a bat file with calls to jar programs. In each line,
    I put a call to the programs with parameters, but bat only
    executes the first line and ends execution.
    All lines of my bat file must be executed.
    What should I do?
    Best Regards,
    Pedro Felipe
    [http://pedrofao.blogspot.com|http://pedrofao.blogspot.com]
    [http://viajantesmundo.blogspot.com/|http://viajantesmundo.blogspot.com/]

    user8730639 wrote:
    I realized that the problem isn`t my bat file. I made tests calling another jar files and then all the lines of the batch file were executed. So, the jar file called on my previous bat is finnishing the execution. I verified and the jar apps worked without error.
    I would like to know if exists any command in Java that can cause this effect (close a batch), to modify the open source code of the application.Not that I know of.
    Is prism a bat file?
    If you are invoking bat files from your bat file without using call that would explain it
    :: mymain.bat file
    :: call the first bat file
    call prism.bat arg1 arg2 arg3
    :: call the other bat file
    call prism.bat arg4 arg5 arg6
    ::

  • Run .bat file with arguments?

    Hi,
       I need to run the .bat file with parameters/arguments in Adode Indesign JavaScript. "File.execute()" executes the file using the appropriate application.It executes the .bat file suceessfully.But I am unable to pass the arguments.I need to execute the command like
    Eg : test.bat parameter1 parameter2
    var myFile=new File("c:\\test.bat");
    myFile.execute();
    The above statements works fine. Is it possible to execute the with parameters. Please suggest the solution to above problem.

    Hi,
    let VB start the *.bat. this works for me:
    #target InDesign
    doTheBat('START "" "C:\\Program Files\\Adobe\\Adobe Photoshop CS5.1 (64 Bit)\\Photoshop.exe"')//Start Photoshop, just a example
    function doTheBat ( _data ) {  
            try 
                var _file = new File('~/myTmpBat.bat'); 
            _file.open( 'w' );  
            _file.encoding = 'UTF-8';  
        _file.writeln ( _data );  
        _file.close();  
        //_file.execute(); 
        myVBScript = "Set WshShell = CreateObject(\"WScript.Shell\")\r"; 
    myVBScript += "WshShell.Run chr(34) & \"C:\\Users\\%USERNAME%\\myTmpBat.bat\" & Chr(34), 0\r"; 
    myVBScript += "Set WshShell = Nothing\r";
    myVBScript += "\r"; 
    app.doScript(myVBScript, ScriptLanguage.VISUAL_BASIC);
        }catch (e){  alert(e);
    Good luck
    Hans-Gerd Claßen

  • How to execute .bat file within pl/sql block

    Hi,
    I want to execute a batch file (.bat) file withing a pl/sql procedure. Please guide me for it.
    Regards

    There are several possible ways to make a call-out from a PL/SQL program to the OS on the database server (but not to the client computer).
    You could use java or an external procedure (you'll need to code it in C) for example.
    You might be able to make use of UTL_HTTP to talk HTTP to another server or UTL_TCP to talk TCP to another server.
    What is it you are trying to do?

  • Executing a file with Java?

    Hi,
    I wanted to know how I could execute a file with java. Here are a couple scenarios - let's say I am developing an anti-spyware utility and I wanted to first write a batch file, and then create it in a folder, then run it when they click "Run". Then afterwards I want to shutdown their computer.
    My Mindset:
    - FileWriter to create the .bat and write the Batch commands.
    - Execute the batch file.
    - Execute the shutdown.exe file to reboot their PC.
    So my simple question is, how can I execute a file?
    Thanks!
    -Josh

    Well here is the code I have:
                try
                    Runtime.getRuntime().exec("cmd.exe /c test.bat");
                catch(IOException e1)
                    //NOTHING
                }Now my cmd.exe is obviously in my Windows System32 folder, and my "test.bat" file is in my C:\ root directory. So I am wondering why that wont execute. I tried a fer other things too like:
    Runtime.getRuntime().exec("cmd.exe  c:\test.bat");that didn't work either, because you can't have a "\" in a string...
    So how can I get this thing to execute the batch file?

  • Execute bat-files

    Hallo,
    I have a problem with the new method execute.
    We have used gui_exec to run a bat-file with
    > command   = c:\file.bat
    > parameter = "c:\my file.txt"
    Now we do the same with the execute.
    > application = c:\file.bat
    > parameter   = "c:\my file.txt"
    but this does not work.
    It works without the quotes, when the path
    has no blanks in it. But it's the user
    how chose the path ...
    Regards,
    Christine

    Hello Joerg,
    thanks for the debugging code for the batch.
    I have done a lot of tests with NT and XP:
          para = l_parameter.
          com  = l_application.
    *CALL FUNCTION 'GUI_EXEC'
    EXPORTING
       COMMAND          = com
       PARAMETER        = para.
    or
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>EXECUTE
      EXPORTING
        APPLICATION            = l_application
        PARAMETER              = l_parameter.
    Testing with NT
    With the GUI_EXEC I get the file dump.txt with:
    Command line: { "D:\test mit leer\mit_.txt"}
    Command line arg #1: {"D:\test mit leer\mit_.txt"}
    The same with EXECUTE: there is no dump.txt-file.
    Testing with XP:
    both the GUI_EXEC and the EXECUTE are writing
    the dump.txt-file with the same content as above.
    So the problem is only with NT and there are
    only a few with it left. They have to use path
    without blank or use XP ...!
    Thanks for your help.
    Regards,
    Christine

  • Executing *.bat file from PL/SQL

    Is there anyway for Executing *.bat file from PL/SQL ?
    Thanks

    Try here:
    asktom.oracle.com/pls/ask/f?p=4950:8:15427268967155079552::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:952229840241

  • How to run a .bat file with string arguments?

    Hi,
    I have a problem in running a .bat file with string arguments
    - the file is XPathOverlap.bat with 2 stringarguments like: "/a" and "//a"
    - the cmd: c:\Downloads>XPathOverlap "//a" "/a" works fine.
    - here is my code:
    public static void test(){
         try{
              String loc1 = "//a";
              String loc2 = "/a";
              String[] cmdarray = {"c:\Downloads\XPathOverlap", loc1, loc2};
              Process p = Runtime.getRuntime().exec(cmdarray);
              p.waitFor();
              System.out.println("Exit Value: "+p.exitValue());
              //code to print command line replies
              InputStream cmdReply = p.getInputStream();
              InputStreamReader isr = new InputStreamReader(cmdReply);
              BufferedReader br = new BufferedReader(isr);
              String line = null;
              while((line=br.readLine())!=null){
                   System.out.println(line);
         }catch(Throwable t){
              t.printStackTrace();
    How can i run this bat file with 2 string arguments?

    Hi,
    thanks thats good and helpfully
    so this code works:
    String loc1 = "\"/a\"";
    String loc2 = "\"//a\"";
    String path = System.getenv("MuSatSolver");
    String[] cmdarray = {"cmd.exe","/C",path+"XPathOverlap.bat", loc1, loc2};
    Process p = Runtime.getRuntime().exec(cmdarray);
    p.waitFor();
    System.out.println("Exit Value: "+p.exitValue());
    InputStream cmdErr = p.getErrorStream();
    InputStreamReader isrErr = new InputStreamReader(cmdErr);
    BufferedReader brErr = new BufferedReader(isrErr);
    String line2 = null;
    while((line2=brErr.readLine())!=null){
         System.out.println("Error: "+line2);
    but now i have another problem, this is the output:
    Exit Value: 0
    Error: java.lang.NoClassDefFoundError: fr/inrialpes/wam/treelogic/_xml/XPathOverlap
    Error: Exception in thread "main" The Exit value is 0, so the process terminates normally.
    I have tested this bat file in cmd and there it works correctly.
    Why do i get this error message?

  • Need to execute bat file by GPO with admin rights

    Hi all
    I created a specific bat file that run regini.exe with specific parameters to set a specific permission in a specific registry key.
    I can execute this bat file from GPO but I need that this bat runs with domain admins rights otherwise script not set the permission in user's registry key.
    Have you any ideas?
    Thanks
    Chris

    > Yes I tested this solution but it's not possible set permission to the
    > key :-(
    Which key are we talking about?
    Martin
    Mal ein
    GUTES Buch über GPOs lesen?
    NO THEY ARE NOT EVIL, if you know what you are doing:
    Good or bad GPOs?
    And if IT bothers me - coke bottle design refreshment :))

  • Hiding the command prompt when executing bat file

    Hi,
    I hava a bat file which contains following
    java -jar MyJar.jar
    When I execute the bat file, the jar file is executed. But a command prompt also opens along with it. I dont want to display the command prompt to the user. Is there any way to hide that command prompt ?
    regards,
    Jatin.

    Is your problem solved?
    If not then
    insted of creating a batch file create a form file in visual basic and write following code in it
    shell "java -jar MyJar.jar"
    Endand then create its exe file.
    It will just launch your jar file and then exit.

  • Is it possible to execute .bat file located in package ?

    Hi,
    in my application i execute a print.bat file using Runtime.exec(), i'd like to place this .bat in package, let's say com.me.testpackage. How is it possible to execute the batch file from that location?
    thanks

    jschell wrote:
    sabre150 wrote:
    jschell wrote:
    >Simple 'for' loops seem to work OK but still more research needed.
    There is escaping in the for loops which is necessary in a bat file and not needed at the command line.
    It seem to be that any command spanning more than one line fails. Fail? The example that gave shouldn't fail. It should simply run both echos.As I understand it, the command sequence
    @echo off
    goto XXX
    echo out
    :XXX
    echo last
    should just output 'last' and not 'out so if it prints both 'out' and 'last' then in my view it 'fails'. Am I missing something?
    >
    >>
    Makes me even more pleased that I work mainly with Linux.Looking up syntax - what about getopts (bourne and korn)? You can also create 'functions', which can be defined later (if I recall correctly) in the script and called multiple times. I don't know how that would work streaming it in.I don't know about consequences of the streaming approach forward definitions in 'bourne' and 'korn' though I was not aware that 'bourne' allowed them. For 'bash' where forward definitions do not seem to be allowed (could I be mistaken in this?) then using        Process process = Runtime.getRuntime().exec("bash", null, new File(System.getProperty("user.home")));the following very simple 'bash' script (which contains loops, if statements and functions but no goto or forward definitions) can be executed without problems - # Simple bash script
    function sayHello {
        echo "Hello" $1
    sayHello "World" ;
    for i in $( ls /tmp ); do
        echo file - $i
    done
    for i in `seq 1 10`;
    do
        echo "seq" $i
    done
    i=0
    while [  $i -lt 6 ]; do
    if [ $i -eq 4 ]; then
        echo "then" $i
    else
        echo "else" $i
    fi
        let i=i+1
    done
    i=12
    until [  $i -lt 10 ]; do
    echo "until" $i
    let i-=1
    doneIn the past, I have also published examples of how to run Perl scripts using the same basic approach. The heart of the examples is         final String perlScript = "#!/bin/perl\n" +
                "print \"PID $$\\n\";\n" +
                "print \"UID $<\\n\";\n" +
                "print \"EUID $>\\n\";\n" +
                "print \"GID $(\\n\";\n" +
                "print \"\\nProcessing the command line arguments\\n\";\n" +
                "foreach (@ARGV) {\n" +
                "    $n = factorial($_);\n" +
                "    print \"    $_! = $n\\n\";\n" +
                "}\n" +
                "print \"\\n\".'@INC'.\"\\n\";\n" +
                "foreach (@INC) {\n" +
                "    print \"    $_\\n\";\n" +
                "}\n" +
                "print \"\\n\".'%ENV'.\"\\n\";\n" +
                "foreach (keys %ENV) {\n" +
                "    print \"    $_==$ENV{$_}\\n\";\n" +
                "}\n" +
                "$x = theAnswerToTheUltimateQuestion();\n" +
                "print \"\\nThe answer to the ultimate question is ... '$x'\\n\";\n" +
                "sub theAnswerToTheUltimateQuestion()\n" +
                "{\n" +
                "    return 3*2*7;\n" +
                "}\n" +
                "sub factorial()\n" +
                "{\n" +
                "    my ($n) = @_;\n" +
                "    return ($n > 1) ? $n * factorial($n-1) : 1;\n" +
                "}\n";
            System.out.println(perlScript);
             * The perl source can be from any InputStream. Here I use a
             * ByteArrayInputStream just as a demonstration.
            final InputStream perlSource = new ByteArrayInputStream(perlScript.getBytes());
             * The '-' indicates that the Perl script comes from stdin. The "a","b","c" etc
             * are the command line arguments passed to the Perl script.
            final String[] command =
                "perl", "-", "5", "6", "7", "8", "9", "10"
            final Process process = Runtime.getRuntime().exec(command);piping the 'perlSource' stream to the process stdin.
    This runs as expected on both Linux (FC9 and Ubuntu 8.04) and on Windows using Active Perl.
    Please don't take my use of a String to hold the Perl script to mean that I in any way endorse this approach - I just wanted a simple means to create a self-contained example.
    >
    And the c shell has a goto also.One day I might find some time and investigate 'c' shell goto in this context - since I have not used csh for at least 8 years I am very rusty.
    I can't say that the 'streaming' approach will work with all Linux shells but I can say that on Linux I have had no problem with Perl and Bash. If anyone needs to use the 'streaming' approach with another shell then it takes just a few minutes to setup a test harness. If any problems are found then people can always resort to the 'Plan B' approach.
    I am still pleased I work mainly with Linux and Unix.

  • Problem executing .bat file from within Java class

    I'm stumped: I have no problem executing a .bat file that sets classpaths and executes a Java jar, but when I try to execute other executables first and then the .jar, my application hangs and since the DOS box doesn't come up over my GUI, I can't see what's going on.
    This works:
    public void execute() throws Exception {
    String s = "c:\\cs47auxs\\omnijar\\omni.bat";
    Process p = Runtime.getRuntime().exec("\"" + s + "\"");
    p.waitFor();
    JOptionPane.showMessageDialog(frame,
    "The Database Has Been Successfully Reloaded.",
    "Information Message",
    JOptionPane.INFORMATION_MESSAGE);
    Here's the .bat 'omni.bat'
    set JAVA_HOME=c:\j2sdk1.4.2_04\bin
    %JAVA_HOME%\java -jar C:\CS47AUXS\OMNILOADJAR\OmniLoad.jar
    This doesn't work:
    public void execute() throws Exception {
    String s = "c:\\cs47auxs\\omnijar\\jobomni.bat";
    Process p = Runtime.getRuntime().exec("\"" + s + "\"");
    p.waitFor();
    JOptionPane.showMessageDialog(frame,
    "The Database Has Been Successfully Reloaded.",
    "Information Message",
    JOptionPane.INFORMATION_MESSAGE);
    Here's the .bat file 'jobomni.bat'
    SET NETX_HOME=C:\CS47AUXS
    SET COBOL_HOME=C:\CS47AUXS\OFFLINE
    CD %NETX_HOME%
    CALL SET-NETX.CMD
    CD %COBOL_HOME%
    SSBPPC10 JOBOMNI X
    SET JH=C:\J2SDK1.4.2_04\BIN
    SET OMNI_HOME=C:\CS47AUXS\OMNILOADJAR
    CD %OMNI_HOME%
    %JH%\java -jar omniload.jar
    Can anyone shed some light here? Even when I execute the application from the command line the new DOS box doesn't become visible nor can I see any errors. If I could just get that visibility, I could probably figure out what is going wrong.

    Same problem with me as well.... Badly looking for a solution...
    I predict the following:
    - If your batch file has pretty less number of dos/shell commands then it gets executed fine with exec() and proc.waitFor();
    - If you increase the number of dos/shell commands in the bat file then try executing it then it definately hangs at proc.waitFor();
    Even "cmd.exe /C C:\\test.bat" hangs... if the commands are more...
    Is this some sort of bug? or am i doing anything wrong? I tried searching for solution on the net and search forums... but couldnt find a solution for the same.. not sure where i missed, what i missed...
    Incase some one finds a solution.. do post it here...
    Message was edited by:
    amadas

  • Executing bat file

    Hi..
    how can we execute a bat file in file..
    like batch file containg notepad .exe
    now executing the batch file from flex and notepad opens i want this
    thanks

    Well guys thanks for your response..
    i got an api named MERAPI that do this work..it has code written in java..and acts as a bridge between java and air
    http://www.merapiproject.net/index.php?option=com_content&view=article&id=47&Itemid=64&lim itstart=3
    now what i found here was that for executing the exe from flex it provides a function named systemExecute(array as parameter);
    I tried to implement this but was stuck somewhere with java..then got a help from the google groups..
    http://groups.google.com/group/merapi-project/browse_thread/thread/34db7ed7f0187b29?pli=1
    where the person saysin order to do this you have to run the bootstrap file..but how to do that
    Please help

  • Problem in executing bat files

    hi all
    I developed one console application which has two components;one utility componet and a main componet and both are developed as maven project.i successfully build the componets by successfully set the dependencies.
    i got two jar components.
    then i did the following things
    1.Create one folder ,Say Application
    2.create lib,resources,log folders under Application
    * resources is for logconfiguration file and propertiesfile
    * log folder is for log fles
    * lib is the folder where i place my two jar files
    3.create a .bat file by editing a text file with the following contents and give a .bat extension
    java -cp
    /lib/mainModule.jar;/lib/utilityModule.jar com.my.package.Starter
    Problem:-i got the following message while i was trying to execute the bat file
    "Failed to load Main-Class manifest attribute from /lib/mainModule.jar"
    Do i need to do more configuration on that.....please help
    mobi

    so you use bat, why you use -cp option?
    you can write it as:
    set classpath=%classpath%;/lib/mainModule.jar;/lib/utilityModule.jar
    java com.my.package.Starter

Maybe you are looking for

  • How to make utf-8 default encoding firefox 4.0

    how to make utf-8 default encoding firefox 4.0

  • Float Images to Left of Content DIV?

    I am using iWeb 3.0.4 with the 2.0 Layered Paper theme. I am trying to figure out a way to allow the wagon wheels (shown in the screen shot below) to extend to the left visably.  I have them at the front, and when I hold down Command while dragging,

  • Object Level Security

    We use home grown Authentication system and database tables for Authorization. Here is the Situation we are in: Domain Object : Address Block We have business rule which states check User/Group Privileges on Address Block before Create, Update, Delet

  • What happens after TM deletes full backup & only incrementals are left?

    If I understand this correctly, Time Machine does 1 complete backup & then incremental backups after that. If that's correct, what happens when the full backup is about to be erased because the backup drive is full? Does TM alert you to this & ask if

  • Auto importing

    I have looked into getting Aperture to watch a folder so it will automatically import any new files, but am not having much success. I'm not shooting while tethered to a camera. I have a folder that contains all my images, in their various sub-folder