LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

system exec.vi wont take multiple cmd line options

been using sys exec.vi w/o any problems for 1 cmd line option but when I go to more than 1 I get either an error 2 or 193.  Help on it tells me to put it into a bat file so I do and still get the error 2 code.
 
I have had no problems using it for 1 option... I have the working directory path tied to where the command is.
 
working dir  = c:\program files\coppergate\production
command = netinf -i <ipaddy> -l 1400 -n 1500.
 
tia...
Message 1 of 18
(9,944 Views)
Did you try putting a cmd /c in front of the command string?
0 Kudos
Message 2 of 18
(9,936 Views)

awesome, thanks.  works now.  

 

and why dont the NI doc's indicate this??? (sarcasim... not expecting an answer 😉 )

Message 3 of 18
(9,914 Views)


steve05ram360 wrote:

awesome, thanks.  works now.  

and why dont the NI doc's indicate this??? (sarcasim... not expecting an answer 😉 )



I'll answer anyway.  I have no idea why they don't indicate this.  I haven't needed to use system exec yet.  I just remember reading that tip in other message threads.  I'm not sure if you would always need it.  It may depend on the command.  I was playing with it for notepad and had varying results.
 
notepad    -  Notepad came up
cmd notepad - screen flashed, notepad did not come up
cmd /c notepad   -  screen flashed, notepad did come up, it left command DOS window in background.
 
If you open up a command windows from the start menu, type in cmd /?   You will see several screens of different syntax for that command.
0 Kudos
Message 5 of 18
(9,905 Views)
oops... I guess thats what I get for programming on a small screen... now I see it.
 
thanks for the input guys...
0 Kudos
Message 6 of 18
(9,898 Views)

I have an other question, i have several cmd lines need to execute, but each time when calling the "system exec.vi" can just run one single cmd, is that right? Is there any way to execute multiple lines?

 

for eg. my default path is: D:\Documents and Settings\Administrator>

I need go to C:\test and run "dir".

Everytime call the exec.vi will go to the default directory. Anyone can help to show me how to execute the multiple cmd lines.

 

Thanks!

david

 

win xp, lv 8.6

0 Kudos
Message 7 of 18
(9,169 Views)

Hi David,

write your cmds into a batch file and run it with the SystemExec function.

 

Mike

0 Kudos
Message 8 of 18
(9,167 Views)

MikeS81 wrote:

Hi David,

write your cmds into a batch file and run it with the SystemExec function.

 

Mike


 

... if the commands change according to the program output:

Create the batch file just before you need it and delete it after running it so you don't fill the HDD with useless files. Smiley Wink

 

James

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 9 of 18
(9,144 Views)

For general multi commands through System Exec everything so far has been right. However the working directory parameter for System Exec should actually take care about the initial set dir command already. So no need to have a seperate command executed for that. Also the dir command is not an application on the system but an internal command to the DOS command line so you will have to execute it with "cmd /c dir" since the System Exec is not a normal DOS command line but simply accesses the OS means to startup a process. So if you need command line functionality you have to explicitedly launch it first.

 

As to the original poster problem, it has most likely to do with parsing the command line parameters into a command argument list. Not sure if the LabVIEW System Exec does that and how. Depending what Windows API functionality it uses to create the process it may have to do all the parsing but somehow fail on multiple arguments. Going through cmd lets cmd parse the entire parameter list which seems to work better for multiple arguments.

Message Edited by rolfk on 04-27-2010 01:15 PM
Rolf Kalbermatter
My Blog
0 Kudos
Message 10 of 18
(9,135 Views)