# Sys.which

0th

Percentile

##### Find Full Paths to Executables

This is an interface to the system command which, or to an emulation on Windows.

Keywords
utilities
##### Usage
Sys.which(names)
##### Arguments
names
Character vector of names or paths of possible executables.
##### Details

The system command which reports on the full path names of an executable (including an executable script) as would be executed by a shell, accepting either absolute paths or looking on the path.

On Windows an ‘executable’ is a file with extension ‘.exe’, ‘.com’, ‘.cmd’ or ‘.bat’. Such files need not actually be executable, but they are what system tries.

On a Unix-alike the full path to which (usually ‘/usr/bin/which’) is found when R is installed.

##### Value

A character vector of the same length as names, named by names. The elements are either the full path to the executable or some indication that no executable of that name was found. Typically the indication is "", but this does depend on the OS (and the known exceptions are changed to ""). Missing values in names have missing return values (as from R 3.0.0).On Windows the paths will be short paths (8+3 components, no spaces) with \ as the path delimiter.

##### Note

Except on Windows this calls the system command which: since that is not part of e.g.\ifelse{latex}{\out{~}}{ } the POSIX standards, exactly what it does is OS-dependent. It will usually do tilde-expansion and it may make use of csh aliases.

In R 2.x.y, arguments containing spaces or other metacharacters needed to be escaped as they would be for a shell: for example Windows paths containing spaces needed to be enclosed in double quotes.

• Sys.which
##### Examples
library(base) ## the first two are likely to exist everywhere ## texi2dvi exists on most Unix-alikes and under MiKTeX Sys.which(c("ftp", "ping", "texi2dvi", "this-does-not-exist")) 
Documentation reproduced from package base, version 3.3.0, License: Part of R 3.3.0

### Community examples

Looks like there are no examples yet.