Package Batch File Error Level?

I have ended all of my SCCM Packages witht he following:
exit /B %EXIT_CODE% and the scripts are running, but even if they don't run (fail) the console shows success.
In reading this this
Post if I understand correctly they are saying to remove the /B after exit and this will then let sccm if the batch file truly completed or failed?
Example Batch File:  Should it end with exit /B %EXIT_CODE% or exit %EXIT_CODE% or exit %ERRORLEVEL%?  Let me know that is best practices... Thanks!
REM Uninstall Microsoft Lync 2010 if Exist
if exist "C:\Program Files\Microsoft Lync\communicator.exe" GOTO UNINSTALLLYNC
if exist "C:\Program Files (x86)\Microsoft Lync\communicator.exe" GOTO UNINSTALLLYNC
:UNINSTALLLYNC
taskkill /im communicator.exe /F
taskkill /im outlook.exe /F
MsiExec.exe /X{81BE0B17-563B-45D4-B198-5721E6C665CD} /qn /norestart
goto Office2013
:Office2013
REM Install Office 2013 w/ SP1
if exist "C:\Program Files\Microsoft Office\Office15\lync.exe" GOTO OfficeInstalled
if exist "C:\Program Files (x86)\Microsoft Office\Office15\lync.exe" GOTO OfficeInstalled
if exist "C:\Program Files\Microsoft Office\Office15\WINWORD.EXE" GOTO OfficeInstalled
if exist "C:\Program Files (x86)\Microsoft Office\Office15\WINWORD.EXE" GOTO OfficeInstalled
ECHO Installing Micrsoft Office 2013 - Please wait.......
"%~dp0setup.exe" /adminfile "%~dp0Office2013.MSP"
goto SCCMEND
:OfficeInstalled
Echo Office 2013 is Already Installed
goto SCCMEND
:SCCMEND
REM Return the exit code to SCCM
exit /B %EXIT_CODE%

A handful of comments here:
- First, the exit code of a batch file will automatically be set to the exit code of the last command run
- %EXIT_CODE% is not defined or set anywhere (in the above code) so using
exit %EXIT_CODE% is meaningless. You need to
- Using the /B will depend upon how you are calling the batch file. If you are calling it by relying on the .bat file extension, then you shouldn't have to use it. If however you are calling it by running cmd /c, then you will have to use it. Either way,
using it doesn't hurt.
- %ERRORLEVEL% is not valid:
http://support.microsoft.com/kb/69576/en-us
- You should use the technique as outlined in the link in the previous bullet to set a value -- it could be %EXIT_CODE% if you want to stick with that and then return that value using exit /b
Jason | http://blog.configmgrftw.com

Similar Messages

  • Running batch file error

    I have already tried to find some solution on Java Essential forum, not much success there. I hope someone might suggest something here.
    Design: one big file, split into chunks, recombined according to some order, feeded to some exe file, and finally compilation of results.
    Problem: I can run that smoothly with jdk, however, when I use Java beans I am running into troubles. I can split the file, create an order, recombine the files, but when I try to feed it to an exe file(through a batch file) i get this error:
    endfile record was detected in a READ statement (UNIT = 3). Error occurs at _MAIN__. A dubplicate file name exists or the file cannot be foundThe main method is something like this:
            s.split_ftn07() ;
            s.Define_Order() ;
            for (int i = 1 ; i < 11 ; i ++)
                s.re_combine(i) ;
                s.run_Fastran(i) ;
            s.ass_Result() ;my batch file:
    @echo off
    cd
    "C:\JBoss\jboss-4.0.5.GA\bin\Fastran\FASTRAN.EXE"
    ren FTN04 FTN04i
    :finishand my method that runs the batch file: (as soon as it pass the exec(), it opens the cmd.exe windows and displays the error message).
    public void run_Fastran(int x)
           try
               File ftn07_i = new File("C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\ftn07_" + x) ;
               File ftn07 = new File("C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\ftn07") ;
               ftn07_i.renameTo(ftn07) ;
               String path = "";
               path = "cmd /c start C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\FCall.bat";
               Runtime rt = Runtime.getRuntime();
               Process proc = rt.exec(path);
               String nameNew = "C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\FTN04-" + x + "-p12";//change p12 with the crack path input by user.
               File file = new File("C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\FTN04i");
               while (file.exists()==false)//until FTNO4i come into existence
                // File with new name
               File file2 = new File(nameNew);
                // Rename file
               file.renameTo(file2);
               File ftn07Back = new File("C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\ftn07") ;
               File ftn07_iBack = new File("C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\ftn07_" + x) ;
               ftn07Back.renameTo(ftn07_iBack) ;
               File ftn07_i_del = new File("C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\ftn07_" + x) ;
               ftn07_i_del.delete() ;
           catch(Exception e)
               e.printStackTrace();
        }I am tired to figure out whats going on? Need some help here, will be greatly appreciated. Thanks

    Thanks to all, I really appreciate all the pains which all of you have taken in resolving my problem.
    It wasn't Java problem, rather batch file problem. I was only changing the directory, and was not providing for the exe file to run.
    @echo off
    cd  "C:\JBoss\jboss-4.0.5.GA\bin\Fastran"
    "C:\JBoss\jboss-4.0.5.GA\bin\Fastran\FASTRAN.EXE"
    ren FTN04 FTN04i
    EXIT
    :finishNow it is working fine.
    I did check the access permissions, no problem with that I guess. The problem was with the path. The batch file couldnt go pass bin directory, and I noticed that only today ;(. At any rate, I changed that and now it is all smooth and dandy.
    Once again, thanks a lot.

  • How do I make a batch file if the .class file uses a foreign package?

    I am trying to make an MS-DOS batch file using the bytecode file from the Java source file, called AddFields.java. This program uses the package BreezySwing; which is not standard with the JDK. I had to download it seperately. I will come back to this batch file later.
    But first, in order to prove the concept, I created a Java file called Soap.java in JCreator. It is a very simple GUI program that uses the javax.swing package; which does come with the JDK. The JDK is currently stored in the following directory: C:\Program Files\Java\jdk1.6.0_07. I have the PATH environment variable set to the 'bin' folder of the JDK. I believe that it is important that this variable stay this way because C:\Program Files\Java\jdk1.6.0_07\bin is where the file 'java.exe' and 'javac.exe' are stored. Here is my batch file so far for Soap:
    @echo off
    cd \acorn
    set path=C:\Program Files\Java\jdk1.6.0_07\bin
    set classpath=.
    java Soap
    pause
    Before I ran this file, I compiled Soap.java in my IDE and then ran it successfully. Then I moved the .class file to the directory C:\acorn. I put NOTHING ELSE in this folder. then I told the computer where to find the file 'java.exe' which I know is needed for execution of the .class file. I put the above text in Notepad and then saved it as Soap.bat onto my desktop. When I double click on it, the command prompt comes up in a little green box for a few seconds, and then the GUI opens and says "It Works!". Now that I know the concept of batch files, I tried creating another one that used the BreezySwing package.
    After I installed my JDK, I installed BreezySwing and TerminalIO which are two foreign packages that make building code much easier. I downloaded the .zip file from Lambert and Osborne called BreezySwingAndTerminalIO.zip. I extracted the files to the 'bin' folder of my JDK. Once I did this, and set the PATH environment variable to the 'bin' folder of my JDK, all BreezySwing and TerminalIO programs that I made worked. Now I wanted to make a batch file from the program AddFields.java. It is a GUI program that imports two packages, the traditional GUI javax.swing package and the foreign package BreezySwing. The user enters two numbers in two DoubleField objects and then selects one of four buttons; one for each arithmetic operation (add, subtract, multiply, or divide). Then the program displays the solution in a third DoubleField object. This program both compiles and runs successfully in JCreator. So, next I moved the .class file from the MyProjects folder that JCreator uses to C:\acorn. I put nothing else in this folder. The file Soap.class was still in there, but I did not think it would matter. Then I created the batch file:
    @echo off
    cd \acorn
    set path=C:\Program Files\Java\jdk1.6.0_07\bin
    set classpath=.
    java AddFields
    pause
    As you can see, it is exactly the same as the one for Soap. I made this file in Notepad and called it AddFields.bat. Upon double clicking on the file, I got this error message from command prompt:
    Exception in thread "main" java.lang.NoClassDefFoundError: BreezySwing/GBFrame
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
    4)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    Caused by: java.lang.ClassNotFoundException: BreezySwing.GBFrame
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    ... 12 more
    Press any key to continue . . .
    I know that most of this makes no sense; but that it only means that it cannot find the class BreezySwing or GBFrame (which AddFields extends). Notice, however that it does not give an error for javax.swing. If I change the "set path..." command to anything other than the 'bin' folder of my JDK, I get this error:
    'java' is not recognized as an internal or external command,
    operable program or batch file.
    Press any key to continue . . .
    I know this means that the computer cannot find the file 'java.exe' which I believe holds all of the java.x.y.z style packages (native packages); but not BreezySwing or any other foreign packages. Remember, I do not get this error for any of the native Java packages. I decided to compare the java.x.y.z packages with BreezySwing:
    I see that all of the native packages are not actually visible in the JDK's bin folder. I think that they are all stored in one of the .exe files in there because there are no .class files in the JDK's bin folder.
    However, BreezySwing is different, there is no such file called "BreezySwing.exe"; there are just about 20 .class files all with names like "GBFrame.class", and "GBActionListener.class". As a last effort, I moved all of these .class files directly into the bin folder (they were originally in a seperate folder called BreezySwingAndTerminalIO). This did nothing; even with all of the files in the same folder as java.exe.
    So my question is: What do I need to do to get the BreezySwing package recognized on my computer? Is there possibly a download for a file called "BreezySwing.exe" somewhere that would be similar to "java.exe" and contain all of the BreezySwing packages?

    There is a lot of detail in your posts. I won't properly quote everything you put (too laborious). Instead I'll just put your words inside quotes (").
    "..there are some things about the interface that I do not like."
    Like +what?+ This is not a help desk, and I would appreciate you participating in this discussion by providing details of what it is about the 'interface' of webstart that you 'do not like'. They are probably misunderstandings on your part.
    "Some of the .jar files I made were so dangerously corrupt, that I had to restart my computer before I could delete them."
    Corrupt?! I have never once had the Java tools produce a corrupt Jar. OTOH, the 'cannot delete' problem might relate to the JRE gaining a file lock on the archive at run-time. If the file lock persisted after ending the app., it suggests that the JRE was not properly shut down. This is a bug in the code and should be fixed. Deploying as .class files will only 'hide' the problem (from casual inspection - though the Task Manager should show the orphaned 'java' process).
    "I then turned to batch files for their simple structure and portability (I managed to successfully transport a java.util containing batch file from my computer to another). This was what I did:
    - I created a folder called Task
    - Then I copied three things into this folder: 1. The file "java.exe" from my JDK. 2. The program's .class file (Count.class). and 3. The original batch file.
    - Then I moved the folder from a removable disk to the second computer's C drive (C:\Task).
    - Last, I changed the code in the batch file...:"
    That is the +funniest+ thing I've heard on the forums in the last 72 hours. You say that is easy?! Some points.
    - editing batch files is not scalable to 100+ machines, let alone 10000+.
    - The fact that Java worked on the target machine was because it was +already installed.+ Dragging the 'java.exe' onto a Windows PC which has no Java will not magically make it 'Java enabled'.
    And speaking of Java on the client machine. Webstart has in-built mechanisms to ensure that the end user has the minimum required Java version to run the app. - we can also use the [deployJava.js|http://java.sun.com/javase/6/docs/technotes/guides/jweb/deployment_advice.html#deplToolkit] on the original web page, to check for minimum Java before it puts the link to download/install the app. - if the user does not have the required Java, the script should guide them through installing it.
    Those nice features in deployJava.js are available to applets and apps. launched using webstart, but they are not available for (plain) Jar's or loose class files. So if 'ensuring the user has Java' is one of the requirements for your launch, you are barking up the wrong tree by deploying loose class files.
    Note also that if you abandon webstart, but have your app. set up to work from a Jar, the installation process would be similar to above (though it would not need a .bat file, or editing it). This basic strategy is one way that I provide [Appleteer (as a downloadable ZIP archive)|http://pscode.org/appleteer/#download]. Though I side-step your part 1 by putting the stuff into a Jar with the path Appleteer/ - when the user expands the ZIP, the parts of the app. are already in the Appleteer directory.
    Appleteer is also provided as a webstart launched application (and as an applet). Either of those are 'easier' to use than the downloadable ZIP, but I thought I would provide it in case the end user wants to save it to disk and transport the app. to a machine with no internet connection, but with Java (why they would be testing applets on a PC with no internet connection, I am not sure - but the option is there).
    "I know that .jar and .exe files are out because I always get errors and I do not like their interfaces. "
    What on earth are you talking about? Once the app. is on-screen, the end user would not be able to distinguish between
    1) A Jar launched using a manifest.
    2) A Jar launched using webstart.
    3) Loose class files.
    Your fixation on .bat files sounds much like the adage that 'If the only tool you have is a hammer, every job starts to look like a nail'.
    Get over them, will you? +Using .bat files is not a practical way to provide a Java app. to the end user+ (and launching an app. from a .bat looks quite crappy and 'second hand' to +this+ user).
    Edit 1:
    The instructions for running Appleteer as a Jar are further up the page, in the [Running Appleteer: Application|http://pscode.org/appleteer/#application] section.
    Edited by: AndrewThompson64 on May 19, 2009 12:06 PM

  • DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER Error while running multiple instances of SSIS through batch files.

    I have an SSIS package which loads data from an Excel file into a SQL Database. This SSIS package is triggered by a batch file. 
    As part of a load test, I have created 20 batch files that run the same package for a different Excel file. 
    To have these batch files run together, I have created 2 master batch files, one to run them sequentially (using CALL) and the to run them parallely (using START). I do have any issues in both of them.
    But when I try to run 5 instances of the same batch file run concurrently (using START XYZ.bat 5 times) only 1 succeeds. CALL XYZ.bat 5 times has no issues. 
    Is it because during START, the Excel file is opened by 1 batch file and unavailable to the other 4 instances? If yes, then why doesn't SSIS throw an error when I run the package through BIDS keeping the Excel file opened? Is there something I can do to
    overcome a FAILURE?
    Nelton D'Souza MS BI Developer

    Yes, it seems that since you open the same file from multiple processes the error occurs due to the sharing violation.
    I guess you will get the error opening several Excel files from BIDS trying to read / write to it if you have two BIDS so it is consistent. Excel disallows multiple access paths by its design.
    Arthur My Blog

  • How do I stop ODI if my DOS BATCH file flags an error?

    I have a DOS batch file as the first step in my ODI package. How do I send a code to ODI to tell it that it has failed and to stop processing the rest of the package? I was told I could use an ODI variable to accomplish this but not sure how.
    Also, how do I pass a semaphore/flag an error in my DOS batch file to ODI ?
    Thanks in advance for your help.
    I tried to search for this info in John's blog: http://john-goodwin.blogspot.com/search?q=error
    but was not able to find it.
    :)

    In your package 1st step is OS Command then some other steps involved, right ?
    In that case you can have your package like this
    OS Command (first step) ---------OK--------------> 2nd step -------------------> 3rd step
    So your 2nd step will run only when the 1st step is successful, it will not start 2nd step as 1st itself has failed .
    Thanks,
    Sutirtha

  • Using packages breaks batch file

    Hi there, I wonder if anyone can help me here.
    I've been continuing work on somebody else's previous project, and everything is fine except for the batch file used to run the program from non development. I decided to use Eclipse to develop as opposed to the previous JCreator, and Eclipse gave an error unless I used packages, however this breaks the batch file
    Here's the orginal text from the batch file -
    java.exe -Xmx256m -classpath C:\InsTra\JARS\ant.jar;C:\InsTra\JARS\jaxen-core.jar;C:\InsTra\JARS\jaxen-jdom.jar;C:\InsTra\JARS\jdom.jar;C:\InsTra\JARS\saxpath.jar;C:\InsTra\JARS\xalan.jar;C:\InsTra\JARS\xerces.jar;C:\InsTra\JARS\xml-apis.jar;c:\InsTra\code_files InsTra
    The batch file is located in C:\InsTra, the external JARS are in a JARS subfolder, and the java and class files are in Code_files. The main class is InsTra. I get the error NoClassDefFoundError
    I've tried making the last bit Code_files.InsTra in case it needed to reference the package, but I'm new to this I'm afraid so have little experience of this sort of thing.
    Any help is welcome
    Thanks
    Daniel

    Then either your compiled class is not on the classpath, or you have not used the correct class name. Or both.
    The classpath must point to the root of the package hierarchy.
    The class name must include the package name (which is dictated by the package line at the top of your source file).
    The compiled class file must be in the correct directory.
    Given the information that you have provided, your class file should have the following path:
    c:\InsTra\code_files\Code_files\It should also have the following line at the top of the .java file:
    pacakge Code_files;Class names are case sensitive. Remember that the class path points to the root of the package hierarchy, NOT each of the directories containing class files. For example, if your classpath is thus:
    c:\fooYour class file is in:
    c:\foo\foo\Spong.classWith a package of:
    package foo;And you execute it with:
    java -classpath c:\foo foo.SpongThen it will work. The following will not:
    java -classpath c:\ foo.Spong
    java -classpath c:\foo\foo Spong
    java -classpath c:\foo\foo foo.Spong
    java -classpath c:\foo\foo Spong.class
    etc.

  • Error on running batch file in ODI

    Hi All,
    I am trying to run a batch file thats on another server.
    So I mapped the network drive to point to that path as X:
    I included OS Command step in the ODI package to call the batch file on X:\.
    I used the following command:
    cmd /c //X:\MyBatchFile.bat
    when I execute the same with & without agent, it shows the following error:
    'Wrong process return code'
    I need some guidance here. Please help!
    Thanks,
    Ruby

    I have seen that this error - Wrong process return code generally comes when syntax are not correct. To correct that i would recommend run the syntax in the Windows system from Oracledi/bin path and check if the that works and once you get the correct syntax ,copy and paste the codes into the OS command and try that should work .
    Make sure you use the correct Agent .

  • Error while calling pscp.exe through a batch file which is called in SSIS Execute Process Task

    Hi,
    I am using Windows Server 2012 R2 Standard, SSIS 2012. I am trying to copy files from a remote location by calling pscp.exe through a batch file (FileCopy.bat at location M:\bin\) which is referenced in a SSIS Execute Process Task. My batch file content
    is,
    ECHO OFF
    echo. >> M:\Prod\bin\SourceFile_FileLog.txt
    echo %date% - %time% - Copy Start (XYZ_a201211155952avx0_69999.NOR.gz) >> M:\Prod\bin\SourceFile_FileLog.txt
    M:\ProdFiles\bin\pscp.exe -unsafe -scp -pw aaaaa myuser@sourceserver:/ABC_data/*.NOR.gz M:\Prod\FromMediation\
    echo %date% - %time% - Copy Complete >> M:\Prod\bin\SourceFile_FileLog.txt
    The error I am getting is 
    [Execute Process Task] Error: In Executing "M:\bin\FileCopy.bat" "" at "", The process exit code was "1" while the expected was "0".
    Exactly same setup but using Windows Server 2003 R2 Enterprise and SSIS 2005, this works fine and copies the files successfully.
    Please provide some guidance on this.
    Thank you!
    'In Persuit of Happiness' and ..... learning SQL.

    Hi,
    This is what I am getting while running the batch file from command prompt
    M:\bin\mttrb1>CDR_FileCopy
    M:\bin\mttrb1>ECHO OFF
    The system cannot find the path specified.
    The system cannot find the path specified.
    scp: M:\Prod\FromMediation\: Cannot create file
    scp: M:\Prod\FromMediation\: Cannot create file
    scp: M:\Prod\FromMediation\: Cannot create file
    The system cannot find the path specified.
    'In Persuit of Happiness' and ..... learning SQL.

  • Java.io.filepermission error while executing a batch file from java prog

    Hi,
    i want run a java program which executes a batch file, both are in a jar file. while am trying this using webstart it shows error:access denied java.io.filepermission <<ALL FILES>>execute. why this happens how to rectify this.
    By
    Vinod

    Clearly, it would be a security vulnerability to be able to do such a thing from the web w/o user granting trust to the application.
    Java Web Start applications run in the Java SE secure sandbox unless they have been granted all-permissions by the user:
    1.) sign all jar files.
    2.) add <security><all-permissions/></security> to the jnlp file.
    The user would then be prompted to grant trust to the applications.
    /Andy

  • Error running ODI scenario from batch file

    Hello, everyone!
    I am loading data into Essbase 11.1.2 from MS SQL Server views using ODI 11.1.1.5.0 and Local agent. I created an interface which runs ok if launched manually from ODI.
    Then I created the scenario named MyScenario for this interface and updated odiparams.bat file in *...\agent\bin* folder as follows:
    set SECU_DRIVER=weblogic.jdbc.sqlserver.SQLServerDriver
    set SECU_URL=jdbc:weblogic:sqlserver://<ServerName>:1433;databaseName=<DatabaseName>
    set SECU_USER=<UserName for Master Repository>
    set SECU_PASS=<encoded password for MasterRepository UserName>
    set ODI_USER=SUPERVISOR
    set ODI_PASS=<encoded password for SUPERVISOR>
    set WORK_REPOSITORY=<Work Repository name>
    Then I created the batch file in which I wrote: *...\agent\bin>startscen MyScenario 001 GLOBAL 5*
    However the scenario is not executed with the following error message:
    ERROR ODI-1132 Agent Internal encountered a warning: ODI-1414: Error connecting to agent Internal: a JDBC error occurs while connecting to the master repository. Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Exception occurred while getting connection: oracle.ucp.UniversalConnectionPoolException: Cannot get Connection from Datasource: java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
    I will be very grateful for any hints!

    A fundamental clarification : where is your master repository database located ? Is it on SQL Server as well ?
    The MS SQL Server connection that you mentioned in the SECU_DRIVER, SECU_URL should point to the MR database.
    Is the server name in SECU_URL a Fully Qualified domain name or just an IP Address reachable from localhost ?
    startscen will spawn a new instance of local agent.
    startcmd will reuse an existing agent (not local).
    Not sure why your local agent is getting a Network Connection Error.

  • When packaging a file in indesign - Error message - Cannot copy necessary linked file(s)

    When packaging a file in indesign - Error message - Cannot copy necessary linked file(s)

    Can you select all Links in the Links Panel
    Use the Flyout Menu on the top right of panel.
    Choose "Utilities>Copy Links to"
    And see if that works.

  • Error executing batch file within web application

    Hi all,
    I am trying to execute a batch file from within my web application (struts 1.2).
    The batch file is being kept inside the 'src' folder. The batch file contains only one command to open NOTEPAD.
    The code inside my Action class is:
    URL url = getClass().getResource("/test.bat");
    java.io.File file = new java.io.File(url.getPath()) ;
    String path = file.getCanonicalPath();
    r.exec(path);
    I have deployed this on tomcat and get an error like this:
    java.io.IOException: Cannot run program "C:\Program%20Files\Apache%20Software%20Foundation\Tomcat%206.0\webapps\CIGTAFAPP\WEB-INF\classes\test.bat": CreateProcess error=2, The system cannot find the file specified
    The problem is not with the batch file because when I try to execute the file directly from the classes folder, it opens up the notepad editor.
    I have a specific requirement where I need to create/read this batch file from within the project structure.
    Can someone please help me with this?
    Regards

    The entire content of the file is as below:
    set javaTestProjectPath=D:\projects\CIGTAF\LRTestCases
    C:
    cd %javaTestProjectPath%
    set path=C:\Program Files\Java\jdk1.6.0_21\bin
    set classpath=%javaTestProjectPath%\bin;%javaTestProjectPath%\lib\selenium-server-standalone-2.20.0.jar;%javaTestProjectPath%\lib\testng-6.4.jar;%javaTestProjectPath%\lib\junit-4.10.jar;%javaTestProjectPath%\lib\poi-3.6-20091214.jar;%javaTestProjectPath%\lib\mail.jar
    javac -verbose %javaTestProjectPath%\src\com\core\testscripts\Mailsetup.java -d %javaTestProjectPath%\bin
    javac -verbose %javaTestProjectPath%\src\com\core\testscripts\MailAuthenticator.java -d %javaTestProjectPath%\bin
    javac -verbose %javaTestProjectPath%\src\com\core\testscripts\ReadData.java -d %javaTestProjectPath%\bin
    javac -verbose %javaTestProjectPath%\src\com\core\testscripts\ReadWriteExcelResults.java -d %javaTestProjectPath%\bin
    javac -verbose %javaTestProjectPath%\src\com\core\testscripts\SeleniumFramework.java -d %javaTestProjectPath%\bin
    java org.testng.TestNG %javaTestProjectPath%\SelXD-Config.xml -d %javaTestProjectPath%\test-output
    none of these are getting executed.
    regards
    Edited by: 887789 on May 4, 2012 1:46 AM

  • Error Happened at RFC Server Cannot Open the Job Batch File.

    We have BW 7.0  and Data services 12.1. We are scheduling a Infopackage in BW that triggers a job in Dataservices server.
    We had checked the connection between Dataservices source system in BW and RFC server on Dataservices side and these connections are good. on the 3rd party sellections tab in infopackage we specify the batch file name that we exported in Dataservices server. When we execute the infopackage we get the following error.
    Error Happened at RFC Server Cannot Open the Job Batch File.
    This error started occuring from yesterday and prior to that it was working fine. We are not understanding what changed in the system to cause this error.
    Can anyone suggest any solutions for the above issue.
    Thanks,
    Naveen.

    I'm not sure what the root cause would be here. Is the file still available ? Did file permissions change ? ...
    But I wanted to point your attention to the fact that in Data Services/Data Integrator XI 3.2 (=12.2) we significantly enhanced the integration with BW. In XI 3.2, the RFC server is now integrated into the Data Services Management Console (so no need to start as a seperate executable) and you can start jobs from BW by just specifting the job's name in the repo (no need anymore to export execution commands to .bat files). So if upgrading to XI 3.2 is an option, things should go much smoother.
    More details on the wiki  : http://wiki.sdn.sap.com/wiki/display/BOBJ/Loading+BW
    Thanks,
    Ben.

  • 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.

  • Batch file gives error "is not recognized as internal command.." after first character

    For every batch file I create, I receive the same error displaying after only running the first character in the file: ' d' is not recognized as an internal or external command, operable command or batch file.
    This occurs whether I run 'dir' cd '../..' or java.exe
    I've confirmed the path environment variable has the correct paths, cmd.exe is assigned to comspec, I'm running as admin, etc. What have I not setup correctly to run batch files. I can run these same commands directly at the command line.
    I'm running the latest version of 8.1, on Toshiba Satellite C855

    We do not have access to your computer, we cannot read your mind, and we cannot see your screen.
    Please copy and paste the exact command you are using and also copy and paste the
    exact error message.
    -- Bill Stewart [Bill_Stewart]

Maybe you are looking for