LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

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.

0 Kudos
Message 1 of 2
(3,763 Views)

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 Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 2
(3,755 Views)