[R] argv[0] --- again

ivo welch ivowel at gmail.com
Mon Apr 3 14:18:11 CEST 2006


hi gabor:  thank you very much.  how do you know this stuff?  I just
looked at the contributors() list, and you are not on it.  may I
highly suggest that a wrapper for this become part of the R base?  it
should also have a link from the commandArgs() help page to whatever
this function should be called.

regards,

/iaw


> But you can still get it from the system. On XP Pro
> (maybe other Windows systems too?) place this in a.r
>
> out <- system("wmic /output:stdout process", intern = TRUE)
> out <- sapply(out, function(x) substr(x, 1, nchar(x)-1))
> print(strsplit(grep("rcmd.exe.*batch", tolower(out), value = TRUE), "
> *")[[1]][4])
>
> and then at the command line type:
>
> Rcmd BATCH a.r
>
> and it will print out a.r
>




More information about the R-help mailing list