[Rd] system()/system2() using short paths of commands on Windows?

Yihui Xie x|e @end|ng |rom y|hu|@n@me
Mon Oct 30 21:36:50 CET 2023


I have read about "system() not using a shell on Windows" on the help
page many times before but never understood what it means technically.
Please forgive my ignorance. I still do not understand it, but thanks
a lot for the explanation anyway! I'm just curious if the full path
would work in system() today. If it still would not work because
today's Windows is still like Windows 95 in this aspect, please ignore
my question and I will ask Microsoft for a refund.

Regards,
Yihui



On Mon, Oct 30, 2023 at 3:03 PM Prof Brian Ripley <ripley using stats.ox.ac.uk> wrote:
>
> On 30/10/2023 16:18, Yihui Xie wrote:
> > Hi,
> >
> > It may have been so for 20+ years but I just discovered today that system()
> > would always try to use the short path of a command on Windows:
> > https://github.com/wch/r-source/blob/635a67/src/gnuwin32/run.c#L141 If
> > that's true, I wonder if it could provide an option to disable this
> > behavior, because we recently ran into a case in which short paths wouldn't
> > work. I wonder what the original motivation of using short paths was. If it
> > was to avoid spaces in paths, wouldn't shQuote() work? Thanks!
>
> No: system on Windows does not use a shell.
>
> The 'original motivation' was to work reliably!  Back in the days of
> Windows 95 when many parts of Windows only supported 8+3 names.
>
> >
> > Regards,
> > Yihui
> >
> >       [[alternative HTML version deleted]]
>
> Please do re-read the posting guide.  It has ' been so for 20+ years '.

My apologies! Sometimes I forget to switch to the plain-text mode when
writing to R mailing lists.

> --
> Brian D. Ripley,                  ripley using stats.ox.ac.uk
> Emeritus Professor of Applied Statistics, University of Oxford
>



More information about the R-devel mailing list