Launch executable with command line arguments

I have a programmer that I need to launch in my cvi code.  I tried the system command and lauchexecutable command but cannot get the programmer to lauch correctly.  If I run it from the command prompt or create a windows shortcut it works fine.  Here is the shortcut I created:
C:\TPD\SAVS20P3\asix\up\up.exe /e c:\tpd\savs20p3\q33.hex/erase /q /p
I'm trying to run the up.exe software with /e c:\tpd\v20_hex\v20.hex /erase /q /p as the command line paramters.
I tried the following code which created the above path with command line
 strcpy(filename,"C:\\tpd\\savs20p3\\asix\\up\\up.exe /e c:\\tpd\\savs20p3\\hex_ee\\");   ///e c:\\tpd\\savs20p3\\hex_ee\\"");
  strcat(filename, hfile);//hex file name will change dynamically
  strcat(filename, "/q /p");
I then tried LaunchExecutable(filename) and system(filename).  The system functions gives an error.  Its trying to lauch the /e c:\tpd\v20_hex\v20.hex file
any suggestions.  I beieve its a simple syntax error.

Well, apart evident typos in the code you posted, which is not creating the command line you stated, I can only think that before "/q" you should add a space to separate the option from the filename.
This code should create the correct command line:
strcpy (hfile, "c:\\tpd\\v20_hex\\v20.hex");
strcpy (filename, "C:\\tpd\\savs20p3\\asix\\up\\up.exe /e ");
strcat (filename, hfile);
strcat (filename, " /erase /q /p");
Proud to use LW/CVI from 3.1 on.
My contributions to the Developer Zone Community
If I have helped you, why not giving me a kudos?

Similar Messages

  • How To Run An External .exe File With Command Line Arguments

    Hiya, could anyone tell me how I can run an external .exe file with command line arguments in Java, and if possible catch any printouts the external .exe file prints to the command line.
    Thanks.

    Using the Runtime.exec() command. And read this:
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

  • Executing another program with command line arguments

    I am very new to Java, so bare with me.
    I have written an encryption/decryption program in C (that accepts command line arguments of the key, mode (encrypt/decrypt), and file), and I have written a GUI for it in Java. It accepts the filename (and has a button which opens the "File/Open" dialog), key, and mode, and has a button to Start the process of the encryption. I'd like for that "Start" button to call my encryption program in C (eep.exe) with the command line arguments of the file, key, and mode. This is what I have written so far :
    Start = new JButton("Start");
    Start.setBounds(150, 180, 90, 25);
    Start.addActionListener(new ActionListener() {     
    public void actionPerformed(ActionEvent ae) {
    Desktop.open(new File("C:\\eep.exe" + " " + filename + " " + mode + " " + key));
    However, I get the error "Cannot make a static reference to the non-static method open(File) from the type Desktop" on the Desktop.open command.
    What should I do? Is Desktop.Open the right way to go about this? If not, what is the right way to go about it?
    Thanks in advance.

    That has helped greatly, but I cannot pass command line arguments to it.
    Using :
    try {
        Desktop.getDesktop().open(new File("C:\\eep.exe"));
    catch (Exception e) {
       System.out.println("Error executing.");
    }I can execute eep.exe, but when I try to pass command line arguments to it, such as
    Desktop.getDesktop().open(new File("C:\\eep.exe" + " " + filename));it fails, get caught and prints "Error Executing."
    I have also tried loading the program, as well as some command line arguments into an array of strings :
    String[] cmdArray = {"C:\\eep.exe", filename};
    Desktop.getDesktop().open(new File(cmdArray));But it gives me the error "The constructor File(String[]) is undefined" on the
    new File (cmdArray)part of the command.

  • Need Help with command line arguments for a class method

    Hey guys,
    I'm fairly new to programming in java.
    I want to a write a class method that adds up its command line arguments which are numbers. For example, if the input was .... 5 2 3....then the output would be 10.
    I have been told to use the Convert to convert a string to a double. I'm ok for writing the class method but I have no idea how to use Convert and why I need it in the method.
    Can anybody help please?

    Hey guys,
    I'm fairly new to programming in java.
    I want to a write a class method that adds up its
    command line arguments which are numbers. For
    example, if the input was .... 5 2 3....then the
    output would be 10.Okay. So you would receive the numbers to add as the String[] argument to a main method. The steps are simple:
    1) declare a variable for the count
    2) for each String in the array:
    2.1) extract the value as a double
    2.2) add this to the count
    3) output the resulting count
    I have been told to use the Convert to convert a
    string to a double.
    I'm ok for writing the class
    method but I have no idea how to use ConvertThere is no class Convert in the Java API.
    and why
    I need it in the method. Do you understand you need to somehow convert each String to a double (step 2.1)? Since Convert is unknown to me, maybe you should just take a look at class Double. It can help you do step 2.1, the rest should be trivial enough.
    http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Double.html
    Give it a go and feel free to post back with a specific problem you are having, accurately described if you please :-)

  • Problem associated with Command Line arguments

    hi ,
    I am not able to pass a file path as command line argument in java.
    Actually i want to run a java program from the command prompt passing a file path . Something like this i tried to do , but its not working.
    D:\VISHAL\src> java CopyFile C:\Documents and Settings\Administrator\Desktop\link.txt
    where ,
    CopyFile is the name of my class which i am going to run
    C:\Documents and Settings\Administrator\Desktop\link.txt is the argument.
    Can anyone tell me whether a java program accepts an argument like this, if yes please tell me the exact syntax..
    Thanks
    Vishal J
    Message was edited by:
    vishal_vj

    is there any other way of solving this?Y don't U try it out with the logic as mentioned
    below it wud be the case if U r not going with
    java CopyFile "C:\Documents and
    Settings\Administrator\Desktop\link.txt" 1
    String filepath = new String();
    for(int i = 0; i < Arg.length; i++)
    filepath.append(Arg);
    File f = new File(filepath);
    What????  This is a non-solution to a non-problem.  First of all, you would be constructing a filename without spaces, when the real path contains spaces.  Secondly, even if you did insert spaces it would not matter.  What if the String (and it does not have to be a filename) contained tabs rather than spaces.  The real (and really only) solution to the problem is to put quotes around the argument, for the exact reason stated in my last post.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Problem with command line argument files and quoted strings

    I'm trying to use the following custom tag:
    -tag com.me.Test.testTag:f:"My Test Tag"
    This works fine when sent straight to the command line, but if I put it in an argument file (@argfile) along with the rest of my command, I get the following error:
    javadoc: Illegal package name: "My Test Tag"
    Any idea why this is happening? If I use a one-word tag header and omit the quotes, javadoc runs with no problems. I'm using Sun's SDK 1.4.1.
    Thanks for your help!
    Linda Howard

    White space is treated a bit differently in an @argfile,
    to enable users to put packages or options on separate lines.
    You might try escaping the spaces:
    "My\ Test\ Tag"
    or using a non-breaking space:
    "My Test Tag"
    What operating system are you on?
    -Doug Kramer
    javadoc team

  • Problem with command line arguments and multiple targets in ant

    Based on the argument value,I have to create properties file .I am using the key value pairs present in the properties file in my build.xml file.
    Here the problem is , I am able to create the properties file,using the argument vaue.i.e.,
    ant -Denv=build-dev copy.
    ant build-all.
    it works fine,but if i want to call another target which uses the propeties file ,at the time of passing argument is failing
    ant -Denv=build-dev copy build-all
    why it is happening ?
    My build.xml file
    <project name="AntParam" default="copy">
    <target name="copy">
    <fail unless="env">You must specify the env property when you run ant.</fail>
    available property="env.prop.file.exists" file="${env}.properties"/>
    <fail unless="env.prop.file.exists">Cannot find ${env}.properties file.</fail>
    copy file="${env}.properties" tofile="build.properties" overwrite="true"/>
    </target>
    <target name="build-all">
    <property name="one.dir" value="${project.home}/two" />
    </target>
    </project>
    "${project.home}"--------this value I am getting from properties file.

    i find solution.

  • Writing command line arguments

    Is there a way in java to specify which command line argument belongs to each option, like in Perl?
    Like -name Sally -age 23 -city New York
    Or would one have to write their own parsing function to do that?

    You see a lot of quick and dirty initialization code that looks likeif (args.equals("-name")) {setName(args[i+1]);}Obviously the getopts people had to write one too many program with command line arguments.

  • Error message in scanning:"The scanning software was launched with improper command- line arguments"

    We have downloaded and installed the HP Photosmart full feature Sostware and Drivers to Photosmart C3183 All-in-one.
    Click the Scan document in Solution Center-
    Error message displayed:
    The scanning software was launched with improper command-line arguments"
    Extended error information: 8,[(-1,0,0)]
    When Hp scan diagnostic utility  was used  - the message was: no scanners installed.
    how can we resolve the scanning problem
    nidataytay

    I have the same problem on a HP 5610 Officejet All-in-One.
    "The scanning software was launched with improper command-line arguments.
    8, [(-1, 0, 0)]"
    What is the solution? The scanner does not work. All other functions, print, fax, copy work from with in the HP Solutions Center software - but not the scanner.

  • Command line arguments with a Labview pda applicatio​n

    Hi Everyone,
    I am in the process of writing some Labview code to run on a PDA that is called from another vendor's software. When called, I need to pass some information to it (in the form of an integer) and then return an error code when it has finished its task (again, as an integer).
    Not being able to compile a my application as a labview dll for to run on a PDA with Windows Mobile 2003, I was hoping to be able to pass command line arguments to my program when compiled as an executable. This doesn't seem to be possible.
    Could someone please confirm that Labview PDA applications do not support command line arguments?
    Any suggestions on how to meet my objective would be most welcome .
    Regards,
    Mark

    Paolo,
    Thanks for your input: storing this information in a text file is a choice we are looking at. But it does leave us with the problem that the vendor's software will not necessarily know when our program has finished running, unless it continuously polls the file to see if there has been any update.
    A dll would be ideal. I was hoping there might be a clever way of emulating this.
    Regards,
    Mark.

  • Using Command Line Arguments with JAVA

    Hi,
    we are using an app called ImageMagick to scale and modify images before they are uploaded to a webserver.
    ImageMagick is called from our Objectiv-C app via
    command line.
    is there a way to this in Java?
    Regards
    Eckbert

    So, ur question is not developing a Java application that
    will do the 'image conversion'; but, your message
    conveys that u want to know how to invoke a Java program built by 'imagemagick' that takes command line arguments?
    Am I right?
    If that's the case, u must look into the documentation
    given along with the download'ed piece of software
    for identifying the 'starting point of the program'. i.e., the
    class that contains the 'main' method! And after you
    identify that class [Eg. ImageMagickStart] then you'll
    have to invoke as follows:
    [you must have Java installed in ur system!]
    c:>java ImageMagickStart
    If the program was written intelligently it must print all
    the command-line arguments required by the above
    program by executing the above command, and from that
    you can identify!
    -RK

  • Sending Command Line Arguments to Jar Executable

    Hi All
    I wish to send Command Line Arguments to Jar Executable.
    i.e. before I Jar'd my program, I would do the following
    public class CmdLnArgmntExp {
    public static void main(String[] args) {
    System.out.println("d");
    for (int i = 0; i < args.length; i++)
    System.out.println(args);
    Running the program in Console.
    Java CmdLnArgmntExp arg1 arg2 arg3 arg4Output:
    arg1
    arg2
    arg3
    arg4
    How would I do this to a Jar executable, hope that made sense
    Thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    java -jar executable-jar-file-containing-class-CmdLnArgmntExp.jar arg1 arg2 arg3 arg4

  • Can I pass command line arguments to LV6 executables?

    Hi,
    in Document ID: 1CNFGHFI I read that
    "LabVIEW 5.x executables cannot take command line arguments. (...) Support for command line arguments may be available in the next major release of LabVIEW."
    Is that so in LV6? It would be a good reason to update because I'd terribly need it.
    Cheers,
    Daniel

    I am unable to find the original one that Dennis posted. The following is the same, but for LabVIEW 6:
    Getting Command Line Arguments from within a LabVIEW VI
    Regards;
    Enrique
    www.vartortech.com

  • DP Execution-Execute a DP without supplying value for command line argument

    DP Execution - How to execute a DP without supplying value for a command line argument?
    My requirement is like Directive should have an optional command line argument.
    i.e., even if the value is not supplied for the command line arg, my DP should run.
    Your help is appreciable.

    What is DP?
    What is Directive?

  • Help with char and command line arguments

    I am writing a program that takes 2 command line arguments (such as 4 b, or 3 4, etc.). It uses the first argument to determine the height of a triangle (how many rows high), and the second is the character with which the triangle is drawn.
    My problem is I tend to code backwards - go for the bigger part and then figure out the smaller things. So, I've written a program that prints out this triangle, BUT I can't figure out how to get the command line arguments into it properly. A number works fine because I can:
    size = Integer.parseInt(args[0]);
    but what do I do if the second argument is a character? Args is a String array (I've been fighting with it for the past 4 hours, so I KNOW its a String array) - so how can I get a char to be read as args[1]?
    Here is my code before adding in the second argument (the char):
    public class Triangle
    public static final void main(String[] args)
    int size;
    if (args.length > 0)
    try
    size = Integer.parseInt(args[0]);
    catch(NumberFormatException e)
    System.out.println("Input Error");
    createFilledTriangle(size);
    System.out.println();
    public static void createFilledTriangle(int size)
    int i = 0;
    int j = 0;
    for(i = size, j = 1; i > 0; i--, j +=2)
    printChar(" ", i);
    printChar("*", j); <-----Instead of using * I want to use the second command line arg
    System.out.println();
    private static void printChar(String str, int total)
    for(int i = 0, i < total; i++)
    if(i%2 == 1)
    System.out.print(str);
    else
    System.out.print(" ");
    Thank you for any help in advance!

    I was sure i send it the other day, i probably send it to the wron guy.
    This will give you more idea about drawing.
    import java.awt.*;
    import java.awt.event.*;
    public class Args extends Frame
         Panel panel = new Tpan();
         int   arg1;
         char  arg2;
    public Args(int a1, char a2) 
         super();
         arg1 = a1;
         arg2 = a2;
         setBounds(1,1,600,400);     
         setLayout(new BorderLayout());
         addWindowListener(new WindowAdapter()
         {     public void windowClosing(WindowEvent ev)
              {     dispose();
                   System.exit(0);
         add("Center",panel);
         setVisible(true);     
    public class Tpan extends Panel
    public Tpan()
    public void paint(Graphics g)
         super.paint(g);
         g.setColor(Color.blue);
         g.drawLine(120,110-arg1,80,110);
         g.drawLine(120,110-arg1,160,110);
         g.drawLine(80,110,160,110);
         g.setColor(Color.red);
         g.drawLine(120,110-arg1,120,110);
         g.setColor(Color.black);
         g.drawString(""+arg2,116,110-arg1/2+10);
    public static void main (String[] args) throws InterruptedException
    // get the 2 arguments from the args insread of a1= , a2=
         int  a1  = 60;
         char a2 = 'a';
         new Args(a1,a2);
    Noah
    import java.awt.*;
    import java.awt.event.*;
    public class Args extends Frame
         Panel panel = new Tpan();
         int arg1;
         char arg2;
    public Args(int a1, char a2)
         super();
         arg1 = a1;
         arg2 = a2;
         setBounds(1,1,600,400);     
         setLayout(new BorderLayout());
         addWindowListener(new WindowAdapter()
         {     public void windowClosing(WindowEvent ev)
              {     dispose();
                   System.exit(0);
         add("Center",panel);
         setVisible(true);     
    public class Tpan extends Panel
    public Tpan()
    public void paint(Graphics g)
         super.paint(g);
         g.setColor(Color.blue);
         g.drawLine(120,110-arg1,80,110);
         g.drawLine(120,110-arg1,160,110);
         g.drawLine(80,110,160,110);
         g.setColor(Color.red);
         g.drawLine(120,110-arg1,120,110);
         g.setColor(Color.black);
         g.drawString(""+arg2,116,110-arg1/2+10);
    public static void main (String[] args) throws InterruptedException
    // get the 2 arguments from the args insread of a1= , a2=
         int a1 = 60;
         char a2 = 'a';
         new Args(a1,a2);

Maybe you are looking for

  • Master Detail module returns to Master page after Detail record saved

    Using Oracle Designer Editor version 10.1.2.0.2 I have generated a Web PL/SQL package set up as a Master/Detail where the Master and Detail records appear in separate windows. The Master window contains multi-records each with a link to the related D

  • Error while installing ECC6.0with PI

    SAPinst ADMINISTRATOR@system:SAP ERP 2005 Support Release2 > SAP Systems > Oracle > central instance >central system installation. in the step 4:-Execute service;phase 19 of 95---- import ABAP. THIS IS THE ERROR IN LOG BROWSER CJS-30022 PROGRAM 'MIGR

  • Carriage Returns in Textarea field in APEX Mail

    Greetings all, I have a form that the users fill out and when they click submit it uses APEX Mail to send the contents to individuals in an HTML format. One of the fields is a text area where the individual will enter information like the sample belo

  • Integration of Workflow and Portal

    hi gurus, Can somebody tell me as how to integrate a workflow with LSO portal? Is there any SPRO settings that need to be maintained? Any inputs in this regard will be highly appreciated. Thanks, VV

  • Non-rectangular Border?

    Hello, Is it possible to use a Border, for example a javax.swing.border.EtchedBorder, to outline a Shape? I'm developing some non-rectangular Buttons and would like to be able to use some of the standard Borders with them. Thanks, Ted Hill