LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

LaunchExecutable of DOS command with Output to File

Hi,

I'm using Win2000, TS3.0 + CVI7.0.

I'm trying to execute a DOS type command with output to file:

LaunchExecutable(c:\\mydir\\myfile.exe para1 >ResultFile);

The command is executed but nothing is output to the file.

Any idea?

Thanks
Rafi
0 Kudos
Message 1 of 9
(4,475 Views)
Just tried this and it defenately creates an output to a file!

LaunchExecutable ("cmd /c dir c:\\ >c:\\list.txt");

where dir - dir.exe
amd c:\\ - para 1
Jattie van der Linde
Engineering Manager, Software & Automation
TEL Magnetic Solutions Ltd
0 Kudos
Message 2 of 9
(4,475 Views)
maybe it does create an output file, but it's not where you expect it to be? perhaps trying putting the full path for the resultFile. Otherwise the syntax looks fine

Regards
John
0 Kudos
Message 3 of 9
(4,475 Views)
Maybe the executable isn't sending output to the standard output window (may be using debug output stream).

Regards,
Ryan K.
0 Kudos
Message 4 of 9
(4,475 Views)
Hi and thanks for answering,

Please notice that the command is suppose to send the output to a file and NOT to the standard output!

The command was tested to work fine outside CVI. The only problme is using it within the CVI program.

Any more ideas?

Thanks
0 Kudos
Message 5 of 9
(4,475 Views)
what is the meaning of cmd/c ??

Thanks
0 Kudos
Message 6 of 9
(4,475 Views)
Like I said, are you sure that the output fileis not somewhere else on your system? you're command 'LaunchExecutable(c:\\mydir\\myfile.exe para1 >ResultFile);' Doesn't specify a pathfor the resultFile, so it would probably use whatever CVI thinks the current working directory is. Try a GetDir just previous to the launchexecutable to see what the current working directory is.
0 Kudos
Message 7 of 9
(4,475 Views)
Starts an instance of the Windows command interpreter.

run cmd /? at the command prompt for a detailed description of what it does.

/C - Carries out the command specified by string and then terminates

An extract from the online help!

CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF]
[[/S] [/C | /K] string]

/C Carries out the command specified by string and then terminates
/K Carries out the command specified by string but remains
/S Modifies the treatment of string after /C or /K (see below)
/Q Turns echo off
/D Disable execution of AutoRun commands from registry (see below)
/A Causes the output of internal commands to a pipe or file to be ANSI
/U Causes the
output of internal commands to a pipe or file to be
Unicode
/T:fg Sets the foreground/background colors (see COLOR /? for more info)
/E:ON Enable command extensions (see below)
/E:OFF Disable command extensions (see below)
/F:ON Enable file and directory name completion characters (see below)
/F:OFF Disable file and directory name completion characters (see below)
/V:ON Enable delayed environment variable expansion using c as the
delimiter. For example, /V:ON would allow !var! to expand the
variable var at execution time. The var syntax expands variables
at input time, which is quite a different thing when inside of a FOR
loop.
/V:OFF Disable delayed environment expansion.
Jattie van der Linde
Engineering Manager, Software & Automation
TEL Magnetic Solutions Ltd
0 Kudos
Message 8 of 9
(4,475 Views)
The redirect (">") is for sending standard output to a file, if you are using direct File I/O in the program then it shouldn't be using the >.

Regards,
Ryan K.
0 Kudos
Message 9 of 9
(4,475 Views)