LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

system exec.vi wont take multiple cmd line options

Thanks everyone!

 

I tried still can not. Can someone give me an example for the batch file? base one my eg example, thank a lot:

default path is: D:\Documents and Settings\Administrator>

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

 

The path of the batch file will be the input of working directory?

 

david

0 Kudos
Message 11 of 18
(3,155 Views)

Hi Rolf,

Actually the "dir" function is just a example, I need to run a lot of CMDs, so it's good to find a way to run multiple cmd lines with using system exec.vi.

I am still trying, will update later.

 

By the way, if anyone have the experience already, can show me a example ah? Appreciated for the help!

 

Regards!

David

0 Kudos
Message 12 of 18
(3,152 Views)

david.chang wrote:

Thanks everyone!

 

I tried still can not. Can someone give me an example for the batch file? base one my eg example, thank a lot:

default path is: D:\Documents and Settings\Administrator>

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

 

The path of the batch file will be the input of working directory?

 

david


You mean you have tried to pass "C:\test" as working directory and "cmd /c dir" as command line?

 

As to executing batch files you simply write a batch file and test it in the command shell to do what you want it to do and then invoke it through system exec. You might need to use "cmd /c mycommand.bat parameters" to pass to System Exec, since the CreateProcess Windows API they may be using inside SystemExec itself does not understand batch files but the command line utility will.

Message Edited by rolfk on 04-28-2010 07:31 AM
Rolf Kalbermatter
My Blog
0 Kudos
Message 13 of 18
(3,153 Views)

Rolf,

oh, sorry, maybe my example is misleading.

Actually I need to run saveral CMDs like cmd1, cmd2, cmd3.....in sequence, can I just call system exec.vi once and run multiple cmd lines?

 

Regards!

David

0 Kudos
Message 14 of 18
(3,149 Views)

david.chang wrote:

Rolf,

oh, sorry, maybe my example is misleading.

Actually I need to run saveral CMDs like cmd1, cmd2, cmd3.....in sequence, can I just call system exec.vi once and run multiple cmd lines?

 

Regards!

David


No you can't. You can however call System Exec multiple times, once for each command, which would be mostly equivalent.

Rolf Kalbermatter
My Blog
0 Kudos
Message 15 of 18
(3,147 Views)
But Mike said can use batch file to achieve that, possible?
0 Kudos
Message 16 of 18
(3,124 Views)

I have tried to use the batch file, it's working. Now can process multiple commands in one step.

Great thanks to Rolf and Mike.

 

David

0 Kudos
Message 17 of 18
(3,108 Views)

rolfk,

 

I'm not that familiar with DOS commands, especially through Labview System Exec. I will be trying out what your below email indicates. In the meantime I pose this issue. I have 3 commands through DOS..

1. burnboot.bat

2. burnconfig.bat P7A

3. burn ETF

 

Here's the kicker. When I launch the attached VI 3 seperate times, each time inputting the above commands (in order 1 thru 3) into the standard input control, it works fine. Command 1....press run button...VI completes | Command 2....press run button....VI completes | Command 3...press run button....VI completes. This process works fine and all operations successfully complete.

 

But when I've tried install a for loop to automatically do all 3 commands, command 1 will always work fine, then commands 2 and 3 are just real fast blips that do not perform the operations. There are no errors being spat out. I even tried the attached VI and imported into TestStand 3 times, each iteration having a different command. Again, command 1 works find, with commands 2 and 3 just flying by.

 

I've tried "waits" with no luck. Any help would be much appreciated. I think the answer to my problem is probably staring me int he face on this board, but again my DOS experience is limited.

 

Thank you for any help you can give. I'm using 8.5. with Windows XP.

 

You will find the commands that I use in the standard input control on the block diagram.

 

Best Regards,

 

Chazzzmd

0 Kudos
Message 18 of 18
(2,878 Views)