Executing batch file using SM49 Tcode

Hi,
Theirs a batch file which is used to encrypt a text file ie from '.txt' to '.enc'.
Seperate Encryption software and Java Pakage is used.
When in SM49 the operating system command is executed,its throwing error
File Not Found Exception.
ie call failed
Java.io.filenotfoundexception :  ..\logs\star_pkcs7-client-events.log(The system cannot find the path specified)
OS is WinNt,File is encrypting at OS level seperately.
All authorisation issue has been taken care of.
If any questions or need information then plz ask
Help me on this...its urgent

hi,
well try the following
       String cmdLine[] = {"cmd.exe","/c","copy.bat"};       Runtime.getRuntime().exec(cmdLine);it works fine in Win NT, the process terminates normally.
cheerz
ynkrish

Similar Messages

  • Why do I get error -17500 when calling a batch file using the call executable step type?

    I am calling a batch file using the call executable step type. If the path to the batch file contains a space I get error -17500 and a message stating there was an error in "Post". For example the path to the batch file is "c:\TestWin\Test Files\...\Program.bat" When I run this I get the above mentioned error, however if I change my directory structure so the path is now "c:\TestWin\TestFiles\...\Program.bat" it runs fine. I use the browse feature to find my batch file so it is not me typing in a path incorrectly. I have removed the batch file and I get a different error stating that it couldn't find the file so it appears that for my error it can find the file but can't run it. I am
    sure that this has something to do with the fact that batch files are written in DOS but really don't want to resort to changing my directory structure on all my test stations. Is there any way to fix this problem so I can leave a space in my path?

    It appears I have figured it out. This was on another computer so I was unaware of how they used their computer. I like you got it to work in the temp directory and in fact got the program.bat file to work as long as I put it under the temp directory, but when I switched out to my TestWin directory it wouldn't work, so I removed everything from the directory except the batch file it self and it work. What I found out after adding files in one at a time is that the person had a file called "Test" with no file extension in there "c:\TestWin\" directory. Removing this file made it work. Putting the file back broke it. So it appeares that when teststand was running it followed the path saw a space and attempted to grab the "Test" file instead of bro
    wsing into the "Test Files" directory. If you create a file in your temp directory called "temp" with no file extension you will see the same problem. Thank you for your help.

  • Executing batch files from websevice using ODI OS Command

    Hi,
    Is it possible to execute the batch files using odi os command from webservices.
    We have developed a webservice, which passess some parameters to one batch file and after that we executing the same batch file in package using odi os command. In opeartor is showing as running, it never ends.
    But if we run the same package from designer, it is executing successfully. Also the same web service is working fine for executing non batch scenarios.
    what could be the problem??
    We got one possible reason for failure...
    For executing the batch from web services, we need read and executable permissions on the drive where batch sits.
    We are logging into ODI using SUPERVISOR. How to give the permissions to SUPERVISOR as we are having windows authentication.
    Edited by: Naveen Suram on Dec 17, 2009 8:07 PM
    As a work around, can we use ODIOSCommand instead of OS Command. But it is asking for starting event? Whether both the commands does the same functionality??
    Edited by: Naveen Suram on Dec 17, 2009 9:08 PM

    From the FAQ:
    2. How do you launch an external program on a Microsoft Windows platform from a program developed on the Java [tm] programming language?
    The following will launch notepad in Microsoft Windows NT:
    Runtime.getRuntime().exec("cmd /c notepad.exe");
    To launch a program in Microsoft Windows 95/98 use:
    Runtime.getRuntime().exec("c:\\windows\\notepad.exe");
    The Runtime class allows interaction between a program and its environment. The first string command instructs the command line interpretor, cmd to open up the calculator application.
    The exec() methods do not use a shell; any arguments must have the full pathname to the shell as well as the command itself.
    For example, to run a shell on the UNIX� platform, type:
    Runtime rt = Runtime.getRuntime();
    Process p = rt.exec("/usr/bin/sh -c date");
    To run a batch file under Microsoft Windows 95/98:
    Process p = rt.exec("command.com /c c:\\mydir\\myfile.bat");
    To run a batch file under Microsoft Windows NT:
    Process p = rt.exec("cmd /c c:\\mydir\\myfile.bat");
    where 'cmd' and 'command.com' are the command-line interpreters for Microsoft Windows machines.
    The Runtime.exec() methods might not work effectively for some processes on certain platforms. Special care should be taken with native windowing, daemon, WIN16/DOS process or some shell scripts.
    regards,
    jarshe

  • Executing batch file from Java stored procedure hang

    Dears,
    I'm using the following code to execute batch file from Java Stored procedure, which is working fine from Java IDE JDeveloper 10.1.3.4.
    public static String runFile(String drive)
    String result = "";
    String content = "echo off\n" + "vol " + drive + ": | find /i \"Serial Number is\"";
    try {
    File directory = new File(drive + ":");
    File file = File.createTempFile("bb1", ".bat", directory);
    file.deleteOnExit();
    FileWriter fw = new java.io.FileWriter(file);
    fw.write(content);
    fw.close();
    // The next line is the command causing the problem
    Process p = Runtime.getRuntime().exec("cmd.exe /c " + file.getPath());
    BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
    String line;
    while ((line = input.readLine()) != null)
    result += line;
    input.close();
    file.delete();
    result = result.substring( result.lastIndexOf( ' ' )).trim();
    } catch (Exception e) {
    e.printStackTrace();
    result = e.getClass().getName() + " : " + e.getMessage();
    return result;
    The above code is used in getting the volume of a drive on windows, something like "80EC-C230"
    I gave the SYSTEM schema the required privilege to execute the code.
    EXEC DBMS_JAVA.grant_permission('SYSTEM', 'java.io.FilePermission', '<<ALL FILES>>', 'read ,write, execute, delete');
    EXEC DBMS_JAVA.grant_permission('SYSTEM', 'SYS:java.lang.RuntimePermission', 'writeFileDescriptor', '');
    EXEC DBMS_JAVA.grant_permission('SYSTEM', 'SYS:java.lang.RuntimePermission', 'readFileDescriptor', '');
    GRANT JAVAUSERPRIV TO SYSTEM;
    I have used the following to load the class in Oracle 9ir2 DB:
    loadjava -u [system/******@orcl|mailto:system/******@orcl] -v -resolve C:\Server\src\net\dev\Util.java
    CREATE FUNCTION A1(drive IN VARCHAR2) RETURN VARCHAR2 AS LANGUAGE JAVA NAME 'net.dev.Util.a1(java.lang.String) return java.lang.String';
    variable serial1 varchar2(1000);
    call A1( 'C' ) into :serial1;
    The problem that it hangs when I execute the call to the function (I have indicated the line causing the problem in a comment in the code).
    I have seen similar problems on other forums, but no solution posted
    [http://oracle.ittoolbox.com/groups/technical-functional/oracle-jdeveloper-l/run-an-exe-file-using-oracle-database-trigger-1567662]
    I have posted this in JDeveloper forum ([t-853821]) but suggested to post for forum in DB.
    Can anyne help?

    Dear Peter,
    You are totally right, I got this as mistake copy paste. I'm just having a Java utility for running external files outside Oracle DB, this is the method runFile()
    I'm passing it the content of script and names of file to be created on the fly and executed then deleted, sorry for the mistake in creating caller function.
    The main point, how I claim that the line in code where creating external process is the problem. I have tried the code with commenting this line and it was working ok, I made this to make sure of the permission required that I need to give to the schema passing security permission problems.
    The function script is running perfect if I'm executing vbs script outside Oracle using something like "cscript //NoLogo aaa1.vbs", but when I use the command line the call just never returns to me "cmd.exe /c bb1.bat".
    where content of bb1.bat as follows:
    echo off
    vol C: | find /i "Serial Number is"
    The above batch file just get the serial number of hard drive assigned when windows formatted HD.
    Same code runs outside Oracle just fine, but inside Oracle doesn't return if I exectued the following:
    variable serial1 varchar2(1000);
    call A1( 'C' ) into :serial1;
    Never returns
    Thanks for tracing teh issue to that details ;) hope you coul help.

  • Running a Batch file Using Java

    hi All ,
    I am executing a DOS batch file using the Java .
    I am using it as
    Process P;
    Runtime rt = Runtime.getRuntime();
    P = rt.exec("C:\\X12TST\\BATCH1.BAT ");
    But in case BATCH1.bat have call to some other Batch File Say Bactch2.bat , i am not getting the output of BATCH2.BAT .
    My Java Program exits as soon as it enters to the point where BATCH1 is calling BATCH2 using (call BATCH2.bat).
    Any help is resolving the problem is highlt appreciated .
    Please advise me if you have any alternative to solve the problem .
    Thanx in advace

    The Runtime.exec() should'nt be used with a .bat or .cmd file since .bat and .cmd are not really executable. I think the expected behaviour you experimentred is a process hang at the last command line of the .bat file.
    Insert "echo XXX" or "net send mycomputer XXX" debug messages in your .bat, you'll see the .bat executes until last line. But the last one NEVER terminates, resulting in a hang in the Java thread doing a process.waitFor().
    The only workaround (or right use of exec) is to call the cmd.exe (with FULL PATH OF cmd.exe SPECIFIED in the exec() call). An exec() calling C:\WINNT\System32\cmd.exe /C mybatch.bat should return properly, cause cmd.exe is a standard Win32 program that will be launched to interpret mybatch.bat then terminate.
    PLEASE UNIX/LINUX USERS : report if the behaviour you get is the same on your plat-form, or if it is -one more- bug in win32 OS. Can you exec() a shell script direcly or do you have to exec() a "bash" or "ksh" or "csh" with you shell script as command line argument ?

  • How to execute batch files in java

    Hi,
      I am trying to execute a batch file using a java program(StopServer in sdm).But i am not able to execute it.

    Greetings.
    You may read this article (http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html)
    to avoid of getRuntime().exec() traps.

  • Two questions: Executing batch files and executing a JAR on boot-up.

    I'm working with Windows XP and and currently I'm having a friend test this on Vista as well. I can't seem to find how to execute a batch file using Runtime.exec(). So far I've been passing the absolute pathname of the batch file as the argument to exec(), but it doens't seem to run, so I'm assuming there's another way.
    Second question, how do I get a JAR file to start running whenever the user turns on the PC?
    Thanks.

    I'm working with Windows XP and and currently I'm
    having a friend test this on Vista as well. I can't
    seem to find how to execute a batch file using
    Runtime.exec(). So far I've been passing the
    absolute pathname of the batch file as the argument
    to exec(), but it doens't seem to run, so I'm
    assuming there's another way.Are you using just Runtime.exec() or have you tried Runtime.getRuntime().exec()? If not, try that and see what happens.
    Second question, how do I get a JAR file to start
    running whenever the user turns on the PC?As far as I know, you can't do that programatically. You have to edit settings on your computer but I am not entirely sure.
    Thanks.

  • Execute batch file having gmake command

    Hi,  I am executing batch file having gmake command in it, when i run batch file directly it works correctly,
    but when i try to execute it from LabVIEW using system Exec.vi  
    i got following error,  
    process_easy: DuplicateHandle(In) failed (e=6)
    process_easy() failed to launch process (e=6)  
    Thanks in advance

    What OS?
    How are you calling it in LV?
    What is in the batch file?
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • 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

  • How to execute batch file from JSP

    hi frens !
    i wanna know how to execute batch file from my JSP.i am using exec() method to get call the batch file. but its not working ....plz help
    here mine code:-
    File F = new File("C:/var.bat");
         try{
          if (F.exists())
            Runtime rt = Runtime.getRuntime();
            String url=F.getAbsolutePath();
             Process proc = rt.exec(url);
            proc.waitFor();
            proc.destroy();
            catch(Exception IOEx){
           System.out.println(IOEx);
      }Thanks and Regards
    Allwyn

    You might improve your chances of getting help if you do two things:
    1) Explain what "not working" means.
    2) ChangeSystem.out.println(IOEx); to IOEx.printStackTrace(); (in the eventhat is in fact related to "not working").

  • How to execute .sql file using ODI

    Hi All,
    I need to execute .sql file using ODI.
    I tried @{path}{file} command in ODI procedure selecting oracle technology.but it is failing.
    Do any one have any other idea to execute .sql file.
    Thanks in advance

    Ohk...I think you can try creating batch file(.bat) if its Windows & call that from ODIOSCommand.
    The bat file should contain scripts which call .sql file using sqlplus  & there you can use @{path}{file} format.
    See if this helps.
    Regards,
    Santy

  • How to run batch file using trigger?

    Hi, i am trying run a batch file using a trigger on a table.
    say i have a table XYZ(col_1 varchar2 primary key, col_2 varchar2)
    the values of col_2 keeps changing and col_1 are constant
    whenever the value of col_2 in any row changes from "on" to "off" i want to run a batch file C:\Users\ABC\Desktop\test.bat
    i did some searching but couldn't find any solution. Thanks in advance
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

    >
    the script will be started around 60-70 times a day
    >
    No - as marwim said the script will be executed every time the trigger is fired. And that trigger, depending on how it is written, might be fired several times for the same transaction.
    And if the trigger is fired the script will be executed even if the transaction that caused the trigger to fire issues a ROLLBACK.
    Triggers are non-transactional. You need to clearly define the business rules for when the script should run. Should it run only when the transaction is COMMITTED? Or should it run if the transaction executes even if the transaction performs a ROLLBACK?
    A trigger is the wrong solution for your problem.
    Please clarify what the business rules are that should control the execution of the script.

  • How to run a batch file using tigger....

    Hi, i am trying run a batch file using a trigger on a table.
    say i have a table XYZ(col_1 varchar2 primary key, col_2 varchar2)
    the values of col_2 keeps changing and col_1 are constant
    whenever the value of col_2 in any row changes from "on" to "off" i want to run a batch file C:\Users\ABC\Desktop\test.bat
    i did some searching but couldn't find any solution. Thanks in advance
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    sorry wrong foum to post.
    will post in the correct one
    how to run batch file using trigger?

    Hallo,
    welcome to the forum.
    This is the forum for the tool {forum:id=260}. Your question should be placed in {forum:id=75} or {forum:id=61}.
    When you post your question there please provide additional information like db version, what kind of trigger you want to use, how you want to prevent the execution when the transaction is rolled back... {message:id=9360002}
    Regards
    Marcus

  • Executing Batch files from Runtime.getRuntime().exec

    Can we execute batch files from Runtime.getRuntime().exec() method.
    Regards,
    Nalini

    hi,
    import java.io.IOException;
    class BatchFileTest{
         public static void main(String args[]){
              try{
              Runtime r = Runtime.getRuntime();
              Process p = r.exec("startcmd.bat");
              catch(IOException en){
                   en.printStackTrace();
    -Regards
    Manikantan

  • Can we run the batch file using simple java application

    Hello sir,
    we want to run the batch file using simple java application. i tried with some example, we run the exe files but not batch file.
    Runtime r = Runtime.getRuntime();
    r.exec("D:\\jboss\\bin\\run.bat");
    My application is server will run when we run the java appliation.
    any suggestion? plz give me the solutions

    yes you can run html file
    WEB.SHOW_DOCUMENT is a built-in that is used in Forms to call URL from a Web Form. It works much like the similar way that a link on an HTML page works and it takes two arguments, one is URL and second one is TARGET, in your case use following.
    WEB.SHOW_DOCUMENT('http://channas.iil.informatics.lk:8890/forms/frmservlet?config=abc.html', '_blank');
    Hope this will work for you
    Abbas

Maybe you are looking for