1

I run a system command with spaces in directory name as followed:

command=paste(shQuote("java -jar C:/DIR A/DF.jar -t"), t1, t2)

I tried also:

command=paste('"java -jar C:/DIR A/DF.jar -t"', t1, t2)

However I get the following:

Error in system(command, intern = TRUE) : 
  '"java -jar C://DIR A/DF.jar -t"' not found

How can I handle space in directory name in Windows?

2
  • 1
    Try quoting only the dir name "java -jar 'C:/DIR A/DF.jar' -t" Commented Sep 12, 2015 at 18:04
  • I tried I get Warning message: running command 'java -jar C:/DIR A/DF.jar -t t1 t2 had status 1 And afterwards I have some problems with the results Commented Sep 12, 2015 at 20:04

1 Answer 1

3

Here is the solution

command=paste('java -jar "C:/DIR A/DF.jar" -t', t1, t2)

use " only for the dir name and the outside with '

Sign up to request clarification or add additional context in comments.

1 Comment

Oh, then the opposite of what I said :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.