07-20-2007 12:53 PM - edited 07-20-2007 12:53 PM
You should also read the this. Simply saying it doesn't work and you get an error is not sufficient. You don't speficy what command you are sending and you don't specify what the error number is. Please don't make the people here try to guess what you are doing. As I already said, I don't get an error with a proper command.
Edit:
Sorry I guess you were posting with the command at the same time I was posting my response. In order to do the cd command, I have to put the cmd /c in front.
Message Edited by Dennis Knutson on 07-20-2007 11:57 AM
07-20-2007 12:59 PM
07-20-2007 01:06 PM
07-20-2007 01:11 PM - edited 07-20-2007 01:11 PM
Message Edited by happybird on 07-20-2007 01:12 PM
Message Edited by happybird on 07-20-2007 01:13 PM
07-27-2007 07:08 PM
Hi Dennis,
I have a MS-dos program shell "Tclsh" in the folder C:\Tcl\bin, usually, when I run Tclsh in command prompt, I will be able to input Tcl (a langauage) command, like "puts {hellw, world} . but when I input the command in the labview as following: "cmd /c cd Tcl cd bin Tclsh" , it seems I did not get the correct output, because I still can not use Tcl command, could you please let me know a clue about that? thanks.
Mike
07-30-2007 10:05 AM - edited 07-30-2007 10:05 AM
A few pointers that may help,,,
The "command line" to system exec.vi runs a program, so for things like "dir" (which are commands to the command line interpreter) you need to tell it that the program to use is the command line interpreter, (cmd), and its command is "dir" so the line would be "cmd /c dir"
According to the help for cmd, the way of entering multiple cmd instructions in a single line is to separate them by &&, so in a command line you would type "cd Tcl\bin && Tcl"
Therefore, you would enter "cmd /c cd Tcl\bin && Tclsh" in your command line input to system exec.vi (Note that the space between cmd and /c is essential)
Alternatively, and for an easier solution, have you checked out the full help for command exec.vi? One of the inputs to the Vi (at least in 8.2) is "working directory". So you could put "C:\Tcl\bin" as the input to working directory, and "Tclsh" to command line and it should be OK. Also think if you want to have the vi wait until Tclsh finishes, or if you want it to continue while Tclsh runs. If your Tclsh uses the dos window for its input/output, and you want to be able to interact with it, you will want to set "wait until completion" to false.
BTW, using "help" rather than "cmd /c help" as input to the vi works because there is a program help.exe (which is also the program that is run when you type help at the command line interpreter)
Rod.
Message Edited by Rod on 07-30-2007 04:07 PM
07-30-2007 11:40 AM
Hi Rod,
I have tried the first method, i input "cmd /c cd Tcl\bin & Tclsh" and I get a output "%" which is the same as in command prompt, then when I begin to input a TCL command after "cmd /c cd Tcl\bin & Tclsh" like " & puts {hello world}", I still can not get the "hello world" in the standard output.
Mike
"A few pointers that may help,,,
The "command line" to system exec.vi runs a program, so for things like "dir" (which are commands to the command line interpreter) you need to tell it that the program to use is
the command line interpreter, (cmd), and its command is "dir" so the line would be "cmd /c dir"
According to the help for cmd, the way of entering multiple cmd instructions in a single line is to separate them by &&, so in a command line you would type "cd Tcl\bin && Tcl"
Therefore, you would enter "cmd /c cd Tcl\bin && Tclsh" in your command line input to system exec.vi (Note that the space between cmd and /c is essential)
Alternatively, and for an easier solution, have you checked out the full help for command exec.vi? One of the inputs to the Vi (at least in 8.2) is "working directory". So you could put "C:\Tcl\bin" as the input to working directory, and "Tclsh" to command line and it should be OK. Also think if you want to have the vi wait until Tclsh finishes, or if you want it to continue while Tclsh runs. If your Tclsh uses the dos window for its input/output, and you want to be able to interact with it, you will want to set "wait until completion" to false.
BTW, using "help" rather than "cmd /c help" as input to the vi works because there is a program help.exe (which is also the program that is run when you type help at the command line interpreter)
Rod."
Message Edited by Rod on 07-30-2007 04:07 PM
07-30-2007 12:08 PM
What you've just done is to give cmd the three commands
cd Tcl\bin
Tclsh
puts (hello world)
It won't understand the third one, and give you an error message when it tries to execute it [The error message will go to standard error] More importantly if there's nothing in standard input, when Tclsh runs it will have no commands. Depending on how Tclsh works, it will either keep waiting for input from standard input (which never arrives) or it sees an end of file on stdin and terminate.
The second method in my previous message is probably better, but in any case the puts.. is standard input and not the command!
Remember you should probably put the wait for completion? to false if you want to interact at the keyboard with Tclsh. If you just want to give Tclsh a series of commands from your vi without keyboard interaction, enter them into the vi's standard input, (probably separated by new lines, but check how Tclsh works) and see the result in standard output.
Rod.
07-30-2007 12:22 PM
07-30-2007 01:06 PM
Hi Rod,
It seems to me that this will not work, as I am trying to input a TCL command in labview, that will require the standard I/O of TCL, but system exec.VI can only accept a MS-Dos command, so when I input "Tclsh" in the command line, I can get "%" symbol as in command prompt, but I can not continue to input a TCL command after the "% "symbol, is my understanding correct?
Mike