title: How does Sys.which() find executable? PhantomJS
body: <p>I am having trouble with PhantomJS and I have managed to whittle it down to <code>Sys.which()</code>. Searching for PhantomJS using <code>Sys.which("phantom")</code> does not return any results. However,when I check my PATH I get:</p>
  
  <pre><code>&gt; Sys.getenv("PATH")
  [1] "C:\\Program Files\\R\\R-3.2.0\\bin\\x64;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\Program Files (x86)\\Intel\\iCLS Client\\;C:\\Program Files\\Intel\\iCLS Client\\;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files (x86)\\Windows Live\\Shared;C:\\Program Files (x86)\\Intel\\OpenCL SDK\\2.0\\bin\\x86;C:\\Program Files (x86)\\Intel\\OpenCL SDK\\2.0\\bin\\x64;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files (x86)\\Calibre2\\;C:\\Program Files (x86)\\MiKTeX 2.9\\miktex\\bin\\;C:\\Go\\bin;C:\\Program Files\\Mercurial\\;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\Git\\cmd;C:\\Program Files (x86)\\Skype\\Phone\\;\"C:\\Program Files\\phantomjs-2.1.1-windows\\bin\";C:\\Rtools\\bin"
  </code></pre>
  
  <p>When I afterwards add:</p>
  
  <pre><code>Sys.setenv(PATH=paste(Sys.getenv("PATH"),"C:\\Program Files\\phantomjs-2.1.1-windows\\bin\\",sep=";"))
  </code></pre>
  
  <p>Now I get the right result. Why does it not work in the previous instance?</p>