Ok… Multiple versions of R for windows installed.
each installs to its own sub folder within c:\program files\R\
So…
q: unique values of pathnames of folders of folder “R” of program files x64 folder
A: C:\Program Files\R\R-3.2.0
A: C:\Program Files\R\R-3.4.2
A: C:\Program Files\R\R-3.5.2
T: 0.556 ms
Each of those folders contains a “uninst000.exe” which needs a /VERYSILENT appended
So Action script
wait {pathnames of folders of folder “R” of program files x64 folder} &"/unins000.exe /VERYSILENT"
produces an error of course
STATUS: Running action…
Command started - wait C:\Program Files\R\R-3.2.0C:\Program Files\R\R-3.4.2C:\Program Files\R\R-3.5.2 &"/unins000.exe /VERYSILENT"
Command failed (Thread execution failed (2)) wait C:\Program Files\R\R-3.2.0C:\Program Files\R\R-3.4.2C:\Program Files\R\R-3.5.2 &"/unins000.exe /VERYSILENT"
— Result —
Evaluation failed!
So What i need it to do is step through each version folder, run the unins000.exe /VERYSILENT in each folder and then move on to the next and then end…
i tried unique values of pathnames etc… no go.
I know im missing something simple… Just not enough coffee.
Thanks.and while that would work with just a few known installed versions, there are a total of over 70 possible versions that could have been installed on multiple machines with a low likelihood of 2 being the same.
Im sure there is a more efficient way of doing it.
Let me know if you run into any issues. When I was testing this I found the uninstaller left the empty “R-version” folder behind, so I had to add the rmdir command also for a clean uninstall.
I was thinking that it might be also handy to mod this to leave the “newest” installation alone. If that would be useful, we can look into that also.
OK Pete, assuming that R continues to use the same naming convention, these modifications should leave the newest install alone.
parameter "NewestInstall" = "{maximum of it of (parenthesized parts 1 of (matches (case insensitive regex "R-(.*)$") of unique values of pathnames of folders of folder "R" of program files x64 folder) as version)}"
parameter "TempScript" = "{value of variable "Temp" of environment}\R-BeGone.bat"
appendfile {concatenation "%0d%0a" of (("%22" & it & "\unins000.exe%22 /verysilent && rmdir /s /q %22" & it & "%22") of unique values of pathnames whose (it does not end with parameter "NewestInstall") of folders of folder "R" of program files x64 folder)}
appendfile exit /b
delete "{parameter "TempScript"}"
move __appendfile "{parameter "TempScript"}"
waithidden "{parameter "TempScript"}"
delete "{parameter "TempScript"}"
Now this does require iterating over the folder structure twice, which is not ideal, but I don’t think it results in a significant performance penalty. If someone doesn’t come up with a more elegant solution this should get the job done.