New R folder names bring out Windows batch file bug

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

New R folder names bring out Windows batch file bug

Gabor Grothendieck
Just wanted to point out to anyone trying to write Windows
batch files that the new R-whatever folder names bring out
a bug in Windows batch files related to short file names.

In particular, this code (which is to the best of my understanding,
valid) gives an error. The solution appears to be to use long file
names, and make sure you quote them, rather than short ones.
That does require that R be able to handle such long names and
I think R does, in fact, handle them but at one time it did not in
all cases so use of short file names is likely just a workaround
from older times.  This does not affect R itself as far as I know
but did affect my batchfiles which I have revised.  I am using
Windows XP.

   C:\>set apath=\Program Files\R\R-2.2.1
   C:\>for /f "delims=" %a in ("%apath%") do set AA=%~sa
   C:\>set aa
   AA=C:\PROGRA~1\R\R-22~1.1.2.1
   C:\>cd %aa%
   The system cannot find the path specified.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: New R folder names bring out Windows batch file bug

Duncan Murdoch
On 12/31/2005 3:59 PM, Gabor Grothendieck wrote:

> Just wanted to point out to anyone trying to write Windows
> batch files that the new R-whatever folder names bring out
> a bug in Windows batch files related to short file names.
>
> In particular, this code (which is to the best of my understanding,
> valid) gives an error. The solution appears to be to use long file
> names, and make sure you quote them, rather than short ones.
> That does require that R be able to handle such long names and
> I think R does, in fact, handle them but at one time it did not in
> all cases so use of short file names is likely just a workaround
> from older times.  This does not affect R itself as far as I know
> but did affect my batchfiles which I have revised.  I am using
> Windows XP.
>
>    C:\>set apath=\Program Files\R\R-2.2.1
>    C:\>for /f "delims=" %a in ("%apath%") do set AA=%~sa
>    C:\>set aa
>    AA=C:\PROGRA~1\R\R-22~1.1.2.1
>    C:\>cd %aa%
>    The system cannot find the path specified.
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

Please let us know Microsoft's response to your bug report.

Duncan Murdoch

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: New R folder names bring out Windows batch file bug

Gabor Grothendieck
Although I independently discovered this bug; its apparently
well known to the experts.  I asked about it on the batch
newsgroup and those knowledgable on this immediately identified
it as such.  I think all one can do is work around it.

On 12/31/05, Duncan Murdoch <[hidden email]> wrote:

> On 12/31/2005 3:59 PM, Gabor Grothendieck wrote:
> > Just wanted to point out to anyone trying to write Windows
> > batch files that the new R-whatever folder names bring out
> > a bug in Windows batch files related to short file names.
> >
> > In particular, this code (which is to the best of my understanding,
> > valid) gives an error. The solution appears to be to use long file
> > names, and make sure you quote them, rather than short ones.
> > That does require that R be able to handle such long names and
> > I think R does, in fact, handle them but at one time it did not in
> > all cases so use of short file names is likely just a workaround
> > from older times.  This does not affect R itself as far as I know
> > but did affect my batchfiles which I have revised.  I am using
> > Windows XP.
> >
> >    C:\>set apath=\Program Files\R\R-2.2.1
> >    C:\>for /f "delims=" %a in ("%apath%") do set AA=%~sa
> >    C:\>set aa
> >    AA=C:\PROGRA~1\R\R-22~1.1.2.1
> >    C:\>cd %aa%
> >    The system cannot find the path specified.
> >
> > ______________________________________________
> > [hidden email] mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
>
> Please let us know Microsoft's response to your bug report.
>
> Duncan Murdoch
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel