R system() command error

306 views Asked by At
system("C:\\pocketsphinx_continuous -infile C:\\temp_speech.wav > c:\\capture.txt")

results into the error

ERROR: "cmd_ln.c", line 604: Unknown argument name '>'

But if i paste the code directly in cmd all goes fine. Thanks in advance. I am using windows8 64bit and R v 3.2.1.

1

There are 1 answers

0
Jan van der Laan On BEST ANSWER

This is because everything after C:\\pocketsphinx_continuous is interpreted as arguments. Your command is not run in cmd. See the help page of system:

command is parsed as a command plus arguments separated by spaces.

...

The most important difference is that on a Unix-alike system launches a shell which then runs command. On Windows the command is run directly – use shell for an interface which runs command via a shell (by default the Windows shell cmd.exe, which has many differences from a POSIX shell).

So, use shell