キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

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...
メッセージ1/18
10,905件の閲覧回数
Did you try putting a cmd /c in front of the command string?
0 件の賞賛
メッセージ2/18
10,897件の閲覧回数

awesome, thanks.  works now.  

 

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

メッセージ3/18
10,875件の閲覧回数
0 件の賞賛
メッセージ4/18
10,867件の閲覧回数


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 件の賞賛
メッセージ5/18
10,866件の閲覧回数
oops... I guess thats what I get for programming on a small screen... now I see it.
 
thanks for the input guys...
0 件の賞賛
メッセージ6/18
10,859件の閲覧回数

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 件の賞賛
メッセージ7/18
10,130件の閲覧回数

Hi David,

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

 

Mike

0 件の賞賛
メッセージ8/18
10,128件の閲覧回数

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. スマイリー ウインク

 

James

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 件の賞賛
メッセージ9/18
10,105件の閲覧回数

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
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 件の賞賛
メッセージ10/18
10,096件の閲覧回数